3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Fix spam detection crash if a spam message is deleted before the spam filter applies

This commit is contained in:
Dragory 2019-04-19 12:26:17 +03:00
parent ee20363dd8
commit 88ed1d9313

View file

@ -6,6 +6,7 @@ import {
getRoleMentions, getRoleMentions,
getUrlsInString, getUrlsInString,
getUserMentions, getUserMentions,
noop,
stripObjectToScalars, stripObjectToScalars,
trimLines, trimLines,
} from "../utils"; } from "../utils";
@ -270,7 +271,7 @@ export class SpamPlugin extends ZeppelinPlugin<ISpamPluginConfig> {
// Then, if enabled, remove the spam messages // Then, if enabled, remove the spam messages
if (spamConfig.clean !== false) { if (spamConfig.clean !== false) {
msgIds.forEach(id => this.logs.ignoreLog(LogType.MESSAGE_DELETE, id)); msgIds.forEach(id => this.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
this.bot.deleteMessages(savedMessage.channel_id, msgIds); this.bot.deleteMessages(savedMessage.channel_id, msgIds).catch(noop);
} }
// Store the ID of the last handled message // Store the ID of the last handled message