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,
getUrlsInString,
getUserMentions,
noop,
stripObjectToScalars,
trimLines,
} from "../utils";
@ -270,7 +271,7 @@ export class SpamPlugin extends ZeppelinPlugin<ISpamPluginConfig> {
// Then, if enabled, remove the spam messages
if (spamConfig.clean !== false) {
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