last commit but unironically
This commit is contained in:
parent
1c34be948a
commit
801f0263b3
2 changed files with 4 additions and 4 deletions
|
@ -69,12 +69,11 @@ app.patch('/dash/server/:server/automod/:ruleid', requireAuth({ permission: 2 })
|
|||
$set: {
|
||||
"automodSettings.spam.$[rulefilter]": {
|
||||
...rule,
|
||||
action: body.action ?? rule.action,
|
||||
action: Number(body.action ?? rule.action),
|
||||
channels: body.channels ?? rule.channels,
|
||||
message: body.message ?? rule.message,
|
||||
max_msg: body.max_msg ?? rule.max_msg,
|
||||
timeframe: body.timeframe ?? rule.timeframe,
|
||||
|
||||
} as AntispamRule
|
||||
}
|
||||
}, { arrayFilters: [ { "rulefilter.id": ruleid } ] });
|
||||
|
|
|
@ -46,7 +46,7 @@ async function antispam(message: Message): Promise<boolean> {
|
|||
logger.info(`Antispam rule triggered: ${rule.max_msg}/${rule.timeframe} -> ${ModerationAction[rule.action]}`);
|
||||
ruleTriggered = true;
|
||||
|
||||
switch(rule.action) {
|
||||
switch(Number(rule.action)) {
|
||||
case ModerationAction.Delete:
|
||||
message.delete()
|
||||
.catch(() => logger.warn('Antispam: Failed to delete message') );
|
||||
|
@ -86,6 +86,7 @@ async function antispam(message: Message): Promise<boolean> {
|
|||
case ModerationAction.Ban:
|
||||
message.reply('(Ban user)');
|
||||
break;
|
||||
default: logger.warn(`Unknown Moderation Action: ${rule.action}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue