mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
automod: add triggers for mod actions
This commit is contained in:
parent
5ffc3e7cc4
commit
93912541b4
34 changed files with 412 additions and 3 deletions
|
@ -18,6 +18,13 @@ import { RoleAddedTrigger } from "./roleAdded";
|
|||
import { RoleRemovedTrigger } from "./roleRemoved";
|
||||
import { StickerSpamTrigger } from "./stickerSpam";
|
||||
import { CounterTrigger } from "./counter";
|
||||
import { NoteTrigger } from "./note";
|
||||
import { WarnTrigger } from "./warn";
|
||||
import { MuteTrigger } from "./mute";
|
||||
import { UnmuteTrigger } from "./unmute";
|
||||
import { KickTrigger } from "./kick";
|
||||
import { BanTrigger } from "./ban";
|
||||
import { UnbanTrigger } from "./unban";
|
||||
|
||||
export const availableTriggers: Record<string, AutomodTriggerBlueprint<any, any>> = {
|
||||
match_words: MatchWordsTrigger,
|
||||
|
@ -40,6 +47,14 @@ export const availableTriggers: Record<string, AutomodTriggerBlueprint<any, any>
|
|||
sticker_spam: StickerSpamTrigger,
|
||||
|
||||
counter: CounterTrigger,
|
||||
|
||||
note: NoteTrigger,
|
||||
warn: WarnTrigger,
|
||||
mute: MuteTrigger,
|
||||
unmute: UnmuteTrigger,
|
||||
kick: KickTrigger,
|
||||
ban: BanTrigger,
|
||||
unban: UnbanTrigger,
|
||||
};
|
||||
|
||||
export const AvailableTriggers = t.type({
|
||||
|
@ -63,4 +78,12 @@ export const AvailableTriggers = t.type({
|
|||
sticker_spam: StickerSpamTrigger.configType,
|
||||
|
||||
counter: CounterTrigger.configType,
|
||||
|
||||
note: NoteTrigger.configType,
|
||||
warn: WarnTrigger.configType,
|
||||
mute: MuteTrigger.configType,
|
||||
unmute: UnmuteTrigger.configType,
|
||||
kick: KickTrigger.configType,
|
||||
ban: BanTrigger.configType,
|
||||
unban: UnbanTrigger.configType,
|
||||
});
|
||||
|
|
24
backend/src/plugins/Automod/triggers/ban.ts
Normal file
24
backend/src/plugins/Automod/triggers/ban.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface BanTriggerResultType {}
|
||||
|
||||
export const BanTrigger = automodTrigger<BanTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "ban") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was banned`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/kick.ts
Normal file
24
backend/src/plugins/Automod/triggers/kick.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface KickTriggerResultType {}
|
||||
|
||||
export const KickTrigger = automodTrigger<KickTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "kick") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was kicked`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/mute.ts
Normal file
24
backend/src/plugins/Automod/triggers/mute.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface MuteTriggerResultType {}
|
||||
|
||||
export const MuteTrigger = automodTrigger<MuteTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "mute") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was muted`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/note.ts
Normal file
24
backend/src/plugins/Automod/triggers/note.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface NoteTriggerResultType {}
|
||||
|
||||
export const NoteTrigger = automodTrigger<NoteTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "note") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `Note was added on user`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/unban.ts
Normal file
24
backend/src/plugins/Automod/triggers/unban.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface UnbanTriggerResultType {}
|
||||
|
||||
export const UnbanTrigger = automodTrigger<UnbanTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "unban") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was unbanned`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/unmute.ts
Normal file
24
backend/src/plugins/Automod/triggers/unmute.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface UnmuteTriggerResultType {}
|
||||
|
||||
export const UnmuteTrigger = automodTrigger<UnmuteTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "unmute") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was unmuted`;
|
||||
},
|
||||
});
|
24
backend/src/plugins/Automod/triggers/warn.ts
Normal file
24
backend/src/plugins/Automod/triggers/warn.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface WarnTriggerResultType {}
|
||||
|
||||
export const WarnTrigger = automodTrigger<WarnTriggerResultType>()({
|
||||
configType: t.type({}),
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ context }) {
|
||||
if (context.modAction?.type !== "warn") {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
return `User was warned`;
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue