From 78790627ad58e69ddab1ee4ddd148da7ad224a46 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 2 May 2019 08:14:17 +0300 Subject: [PATCH] spam: fix failing auto-mute + invalid logs Was caused by outdated way of fetching guild members on demand. --- src/plugins/Spam.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/Spam.ts b/src/plugins/Spam.ts index ea8a72a4..451b9804 100644 --- a/src/plugins/Spam.ts +++ b/src/plugins/Spam.ts @@ -219,7 +219,7 @@ export class SpamPlugin extends ZeppelinPlugin { this.spamDetectionQueue = this.spamDetectionQueue.then( async () => { const timestamp = moment(savedMessage.posted_at).valueOf(); - const member = this.guild.members.get(savedMessage.user_id); + const member = await this.getMember(savedMessage.user_id); // Log this action... this.addRecentAction(type, savedMessage.user_id, savedMessage.channel_id, savedMessage, timestamp, actionCount); @@ -358,7 +358,7 @@ export class SpamPlugin extends ZeppelinPlugin { const recentActionsCount = this.getRecentActionCount(type, userId, actionGroupId, since); if (recentActionsCount > spamConfig.count) { - const member = this.guild.members.get(userId); + const member = await this.getMember(userId); const details = `${description} (over ${spamConfig.count} in ${spamConfig.interval}s)`; if (spamConfig.mute && member) {