From 2a69e45284397375d162d789f8be39109430ae48 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 11 Jul 2020 01:24:54 +0200 Subject: [PATCH] Fetch partial message --- event/listeners/log/messageDelete.js | 7 +++++++ event/listeners/log/messageUpdate.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/event/listeners/log/messageDelete.js b/event/listeners/log/messageDelete.js index 38a353f5..e9ad9a7d 100644 --- a/event/listeners/log/messageDelete.js +++ b/event/listeners/log/messageDelete.js @@ -10,6 +10,13 @@ class messageDeleteListener extends Listener { } async exec(message) { + if (message.partial) { + await message.fetch() + .catch(err => { + return console.error(err); + }); + } + 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 3f8fc43c..93dc63a0 100644 --- a/event/listeners/log/messageUpdate.js +++ b/event/listeners/log/messageUpdate.js @@ -10,6 +10,13 @@ class messageUpdateListener extends Listener { } async exec(oldMessage, newMessage) { + if (oldMessage.partial) { + await oldMessage.fetch() + .catch(err => { + return console.error(err); + }); + } + 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'));