From daea4a0cb41502fc4c7fac8690d5499016e3ad40 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 31 Mar 2021 15:13:09 -0500 Subject: [PATCH] Fix null errors for message deletes (again again) --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5a3886f..5c7fea6 100644 --- a/index.js +++ b/index.js @@ -18,14 +18,18 @@ client.on("guildMemberAdd", member => { }); client.on('messageDelete', message => { - const messageContent = message.content; - const messageAvatar = message.author.avatarURL(); - const messageID = message.id; + const messageContent; + const messageAvatar; + const messageID; let messageAuthor; if (message) { messageAuthor = message.author.tag; + messageContent = message.content; + messageAvatar = message.avatarURL(); + messageID = message.id; } else { messageAuthor = "Someone else deleted this message"; + messageAvatar = "https://64.media.tumblr.com/db1db81cadcf6211524ce9ef1b89bae7/tumblr_inline_olcfuexwZy1se2zq9_500.png"; messageContent = "Unknown"; messageID = "Unknown"; }