From 50bd8e1c066f630bd30d523b82d8264e58ae47ce Mon Sep 17 00:00:00 2001 From: JandereDev Date: Wed, 2 Mar 2022 16:30:58 +0100 Subject: [PATCH] woops again --- bot/src/bot/modules/command_handler.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bot/src/bot/modules/command_handler.ts b/bot/src/bot/modules/command_handler.ts index 2d15367..6cd713f 100644 --- a/bot/src/bot/modules/command_handler.ts +++ b/bot/src/bot/modules/command_handler.ts @@ -42,8 +42,14 @@ let commands: Command[]; msg.author_id == client.user?._id || !msg.channel?.server) return; - if (!msg.member) await msg.channel.server.fetchMember(msg.author_id); - if (msg.author?.bot) return; + try { + if (!msg.member) await msg.channel.server.fetchMember(msg.author_id); + if (!msg.author) await client.users.fetch(msg.author_id); + } catch(e) { + return msg.reply('⚠ Failed to fetch message author'); + } + + if (msg.author!.bot) return; // If we can't reply to the message, return if (!hasPermForChannel(await getOwnMemberInServer(msg.channel.server), msg.channel, 'SendMessage')) {