Check for guild

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-08-21 18:58:39 +02:00
parent 176967b9fd
commit 53faf523d1
2 changed files with 4 additions and 0 deletions

View file

@ -17,6 +17,8 @@ class messageDeleteListener extends Listener {
}); });
} }
if (!message.guild) return;
const logStats = await LogStats.findOne({where: {guild: message.guild.id}}); const logStats = await LogStats.findOne({where: {guild: message.guild.id}});
if (logStats && !message.author.bot) { if (logStats && !message.author.bot) {
const fetchedLogs = await message.guild.fetchAuditLogs({ const fetchedLogs = await message.guild.fetchAuditLogs({

View file

@ -17,6 +17,8 @@ class messageUpdateListener extends Listener {
}); });
} }
if (!oldMessage.guild) return;
const logStats = await LogStats.findOne({where: {guild: newMessage.guild.id}}); const logStats = await LogStats.findOne({where: {guild: newMessage.guild.id}});
if (logStats && oldMessage.content !== newMessage.content && !oldMessage.author.bot) { if (logStats && oldMessage.content !== newMessage.content && !oldMessage.author.bot) {
const channel = this.client.channels.resolve(await logStats.get('channel')); const channel = this.client.channels.resolve(await logStats.get('channel'));