From 9c67d826fc82ec2dff7618952cc67ae0861cdb7f Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sun, 26 Feb 2023 03:34:43 -0500 Subject: [PATCH] Fixed bug with commands without public option --- events/interactionCreate.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 0c9eafe..b1ebb02 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -22,7 +22,20 @@ module.exports = { await authorizeCommand(interaction, command, async () => { await authorizeTokenUsage(interaction, command, async () => { try { - if (command.deferInitialReply || !interaction.options.getBool('public')) await interaction.deferReply({ ephemeral: true }); + if (command.deferInitialReply) { + try { + if (!interaction.options.getBool('public')) await interaction.deferReply({ ephemeral: true }); + } + catch (err) { + if (err instanceof TypeError) { + // The public option doesn't exist in this command + await interaction.deferReply({ ephemeral: true }); + } else { + throw err; + } + + } + } command.execute(interaction); } catch (error) { log.ERROR(error);