From 53faf523d14b3dacfff38031126f049f85747fa0 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 21 Aug 2020 18:58:39 +0200 Subject: [PATCH] Check for guild Signed-off-by: loicbersier --- event/listeners/log/messageDelete.js | 2 ++ event/listeners/log/messageUpdate.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/event/listeners/log/messageDelete.js b/event/listeners/log/messageDelete.js index e9ad9a7d..0b186d0b 100644 --- a/event/listeners/log/messageDelete.js +++ b/event/listeners/log/messageDelete.js @@ -17,6 +17,8 @@ class messageDeleteListener extends Listener { }); } + if (!message.guild) return; + const logStats = await LogStats.findOne({where: {guild: message.guild.id}}); if (logStats && !message.author.bot) { const fetchedLogs = await message.guild.fetchAuditLogs({ diff --git a/event/listeners/log/messageUpdate.js b/event/listeners/log/messageUpdate.js index 93dc63a0..92e6ff51 100644 --- a/event/listeners/log/messageUpdate.js +++ b/event/listeners/log/messageUpdate.js @@ -17,6 +17,8 @@ class messageUpdateListener extends Listener { }); } + if (!oldMessage.guild) return; + const logStats = await LogStats.findOne({where: {guild: newMessage.guild.id}}); if (logStats && oldMessage.content !== newMessage.content && !oldMessage.author.bot) { const channel = this.client.channels.resolve(await logStats.get('channel'));