3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-13 21:57:18 +00:00

added role removal mute overrides to automod and spam plugins

This commit is contained in:
roflmaoqwerty 2020-06-21 11:33:14 +10:00
parent 8bf47ff418
commit fa7d5d0526
4 changed files with 48 additions and 17 deletions

View file

@ -29,6 +29,8 @@ const BaseSingleSpamConfig = t.type({
count: t.number,
mute: tNullable(t.boolean),
mute_time: tNullable(t.number),
remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
clean: tNullable(t.boolean),
});
type TBaseSingleSpamConfig = t.TypeOf<typeof BaseSingleSpamConfig>;
@ -257,12 +259,19 @@ export class SpamPlugin extends ZeppelinPlugin<TConfigSchema> {
const muteTime = spamConfig.mute_time
? convertDelayStringToMS(spamConfig.mute_time.toString())
: 120 * 1000;
muteResult = await mutesPlugin.muteUser(member.id, muteTime, "Automatic spam detection", {
caseArgs: {
modId: this.bot.user.id,
postInCaseLogOverride: false,
muteResult = await mutesPlugin.muteUser(
member.id,
muteTime,
"Automatic spam detection",
{
caseArgs: {
modId: this.bot.user.id,
postInCaseLogOverride: false,
},
},
});
spamConfig.remove_roles_on_mute,
spamConfig.restore_roles_on_mute,
);
}
// Get the offending message IDs
@ -379,12 +388,19 @@ export class SpamPlugin extends ZeppelinPlugin<TConfigSchema> {
if (spamConfig.mute && member) {
const mutesPlugin = this.getPlugin<MutesPlugin>("mutes");
const muteTime = spamConfig.mute_time ? convertDelayStringToMS(spamConfig.mute_time.toString()) : 120 * 1000;
await mutesPlugin.muteUser(member.id, muteTime, "Automatic spam detection", {
caseArgs: {
modId: this.bot.user.id,
extraNotes: [`Details: ${details}`],
await mutesPlugin.muteUser(
member.id,
muteTime,
"Automatic spam detection",
{
caseArgs: {
modId: this.bot.user.id,
extraNotes: [`Details: ${details}`],
},
},
});
spamConfig.remove_roles_on_mute,
spamConfig.restore_roles_on_mute,
);
} else {
// If we're not muting the user, just add a note on them
const casesPlugin = this.getPlugin<CasesPlugin>("cases");