3
0
Fork 0
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:
Dragory 2021-02-14 16:58:02 +02:00
parent 5ffc3e7cc4
commit 93912541b4
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
34 changed files with 412 additions and 3 deletions

View file

@ -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,
});

View 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`;
},
});

View 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`;
},
});

View 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`;
},
});

View 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`;
},
});

View 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`;
},
});

View 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`;
},
});

View 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`;
},
});