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: {
|
$set: {
|
||||||
"automodSettings.spam.$[rulefilter]": {
|
"automodSettings.spam.$[rulefilter]": {
|
||||||
...rule,
|
...rule,
|
||||||
action: body.action ?? rule.action,
|
action: Number(body.action ?? rule.action),
|
||||||
channels: body.channels ?? rule.channels,
|
channels: body.channels ?? rule.channels,
|
||||||
message: body.message ?? rule.message,
|
message: body.message ?? rule.message,
|
||||||
max_msg: body.max_msg ?? rule.max_msg,
|
max_msg: body.max_msg ?? rule.max_msg,
|
||||||
timeframe: body.timeframe ?? rule.timeframe,
|
timeframe: body.timeframe ?? rule.timeframe,
|
||||||
|
|
||||||
} as AntispamRule
|
} as AntispamRule
|
||||||
}
|
}
|
||||||
}, { arrayFilters: [ { "rulefilter.id": ruleid } ] });
|
}, { 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]}`);
|
logger.info(`Antispam rule triggered: ${rule.max_msg}/${rule.timeframe} -> ${ModerationAction[rule.action]}`);
|
||||||
ruleTriggered = true;
|
ruleTriggered = true;
|
||||||
|
|
||||||
switch(rule.action) {
|
switch(Number(rule.action)) {
|
||||||
case ModerationAction.Delete:
|
case ModerationAction.Delete:
|
||||||
message.delete()
|
message.delete()
|
||||||
.catch(() => logger.warn('Antispam: Failed to delete message') );
|
.catch(() => logger.warn('Antispam: Failed to delete message') );
|
||||||
|
@ -86,10 +86,11 @@ async function antispam(message: Message): Promise<boolean> {
|
||||||
case ModerationAction.Ban:
|
case ModerationAction.Ban:
|
||||||
message.reply('(Ban user)');
|
message.reply('(Ban user)');
|
||||||
break;
|
break;
|
||||||
|
default: logger.warn(`Unknown Moderation Action: ${rule.action}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !ruleTriggered;
|
return !ruleTriggered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue