From 1fa4975e18dd5b7dee873205461838a09240c622 Mon Sep 17 00:00:00 2001 From: Dragory Date: Mon, 19 Feb 2018 02:03:53 +0200 Subject: [PATCH] Some extra checks for special messageUpdate and messageDelete cases --- src/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index a0b1271..42c7fa1 100644 --- a/src/main.js +++ b/src/main.js @@ -84,7 +84,7 @@ bot.on('messageCreate', async msg => { * 2) If that message was moderator chatter in the thread, update the corresponding chat message in the DB */ bot.on('messageUpdate', async (msg, oldMessage) => { - if (! msg) return; + if (! msg || ! msg.author) return; if (msg.author.bot) return; if (await blocked.isBlocked(msg.author.id)) return; @@ -116,6 +116,7 @@ bot.on('messageUpdate', async (msg, oldMessage) => { * When a staff message is deleted in a modmail thread, delete it from the database as well */ bot.on('messageDelete', async msg => { + if (! msg.author) return; if (msg.author.bot) return; if (! utils.messageIsOnInboxServer(msg)) return; if (! utils.isStaff(msg.member)) return;