mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Allow Automod to distinguish whether mod actions are manual or automatic (#179)
This commit is contained in:
parent
90b6f4bc86
commit
51db942d97
18 changed files with 106 additions and 32 deletions
|
@ -5,13 +5,25 @@ import { automodTrigger } from "../helpers";
|
|||
interface BanTriggerResultType {}
|
||||
|
||||
export const BanTrigger = automodTrigger<BanTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
configType: t.type({
|
||||
manual: t.boolean,
|
||||
automatic: t.boolean,
|
||||
}),
|
||||
|
||||
async match({ context }) {
|
||||
defaultConfig: {
|
||||
manual: true,
|
||||
automatic: true,
|
||||
},
|
||||
|
||||
async match({ context, triggerConfig }) {
|
||||
if (context.modAction?.type !== "ban") {
|
||||
return;
|
||||
}
|
||||
console.log(context);
|
||||
// If automatic && automatic turned off -> return
|
||||
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
|
||||
// If manual && manual turned off -> return
|
||||
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
|
|
|
@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
|
|||
interface KickTriggerResultType {}
|
||||
|
||||
export const KickTrigger = automodTrigger<KickTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
configType: t.type({
|
||||
manual: t.boolean,
|
||||
automatic: t.boolean,
|
||||
}),
|
||||
|
||||
async match({ context }) {
|
||||
defaultConfig: {
|
||||
manual: true,
|
||||
automatic: true,
|
||||
},
|
||||
|
||||
async match({ context, triggerConfig }) {
|
||||
if (context.modAction?.type !== "kick") {
|
||||
return;
|
||||
}
|
||||
// If automatic && automatic turned off -> return
|
||||
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
|
||||
// If manual && manual turned off -> return
|
||||
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
|
|
|
@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
|
|||
interface MuteTriggerResultType {}
|
||||
|
||||
export const MuteTrigger = automodTrigger<MuteTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
configType: t.type({
|
||||
manual: t.boolean,
|
||||
automatic: t.boolean,
|
||||
}),
|
||||
|
||||
async match({ context }) {
|
||||
defaultConfig: {
|
||||
manual: true,
|
||||
automatic: true,
|
||||
},
|
||||
|
||||
async match({ context, triggerConfig }) {
|
||||
if (context.modAction?.type !== "mute") {
|
||||
return;
|
||||
}
|
||||
// If automatic && automatic turned off -> return
|
||||
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
|
||||
// If manual && manual turned off -> return
|
||||
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
|
|
|
@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
|
|||
interface WarnTriggerResultType {}
|
||||
|
||||
export const WarnTrigger = automodTrigger<WarnTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
configType: t.type({
|
||||
manual: t.boolean,
|
||||
automatic: t.boolean,
|
||||
}),
|
||||
|
||||
async match({ context }) {
|
||||
defaultConfig: {
|
||||
manual: true,
|
||||
automatic: true,
|
||||
},
|
||||
|
||||
async match({ context, triggerConfig }) {
|
||||
if (context.modAction?.type !== "warn") {
|
||||
return;
|
||||
}
|
||||
// If automatic && automatic turned off -> return
|
||||
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
|
||||
// If manual && manual turned off -> return
|
||||
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue