From 5b4efc566fa27cb500429ea6b63ae9e2655d903e Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 8 Jul 2022 22:07:15 +0300 Subject: [PATCH] debugging --- .../components/observers/CommandHandler.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index ac3234e..742c069 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -151,13 +151,17 @@ class CommandHandler extends Observer { if (response instanceof Message) return; - if(response) { - if (response instanceof MessageEmbed) return invoker.reply({ embeds: [response] }); - if (typeof response === 'string') return invoker.reply({ content: response }); - if (typeof response === 'object') return invoker.reply(response); - } + try { // Temporary -- trying to figure out why the bot sometimes errors with unknown interaction + if (response) { + if (response instanceof MessageEmbed) return invoker.reply({ embeds: [response] }); + else if (typeof response === 'string') return invoker.reply({ content: response }); + else if (typeof response === 'object') return invoker.reply(response); + } - if (!invoker.replied) return invoker.reply({ index: 'O_COMMANDHANDLER_COMMAND_NORESPONSE', ephemeral: !invoker.replied }); + if (!invoker.replied) return invoker.reply({ index: 'O_COMMANDHANDLER_COMMAND_NORESPONSE', ephemeral: !invoker.replied }); + } catch (err) { + this.logger.error(`Error responding to ${invoker.command.name}:\n${err.stack}`); + } }