From 164534e8f2c0d8aad1614efa635e4014c033eff6 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Sun, 16 May 2021 20:47:15 -0500 Subject: [PATCH] Fix avatar URL when uncached message is edited or deleted --- bot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.js b/bot.js index 0484885..084d8b3 100644 --- a/bot.js +++ b/bot.js @@ -1069,7 +1069,7 @@ async function bulkDelete(message) { client.on('messageDelete', message => { const deleteEmbed = new Discord.MessageEmbed() .setTitle('Message Deleted') - .setAuthor(message.author ? message.author.tag : "Unknown", message.author.displayAvatarURL({ dynamic: true, size: 1024 })) + .setAuthor(message.author ? message.author.tag : "Unknown", message.author ? message.author.displayAvatarURL({ dynamic: true, size: 1024 }) : client.defaultAvatarURL) .addField('Author', message.author ? message.author.tag : "Message not cached") .addField('Message', message.content ? message.content : "Message not cached") .addField('Channel', message.channel ? message.channel : "Message not cached") @@ -1123,7 +1123,7 @@ client.on('messageUpdate', (originalMessage, editedMessage) => { const editEmbed = new Discord.MessageEmbed() .setTitle("Message Edited") .addField("Link", `[Click here!](${editedMessage.url})`) - .setAuthor(editedMessage.author ? editedMessage.author.tag : "Unknown", editedMessage.author.displayAvatarURL({ dynamic: true, size: 1024 })) + .setAuthor(editedMessage.author ? editedMessage.author.tag : "Unknown", editedMessage.author ? editedMessage.author.displayAvatarURL({ dynamic: true, size: 1024 }) : client.defaultAvatarURL) .addField("Author", editedMessage.author.tag) .setThumbnail(editedMessage.author.displayAvatarURL({ dynamic: true, size: 1024 })) .setFooter("ID: " + editedMessage.id)