Fixed bug with commands without public option

This commit is contained in:
Logan Cusano
2023-02-26 03:34:43 -05:00
parent 14fac69ab7
commit 9c67d826fc

View File

@@ -22,7 +22,20 @@ module.exports = {
await authorizeCommand(interaction, command, async () => { await authorizeCommand(interaction, command, async () => {
await authorizeTokenUsage(interaction, command, async () => { await authorizeTokenUsage(interaction, command, async () => {
try { 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); command.execute(interaction);
} catch (error) { } catch (error) {
log.ERROR(error); log.ERROR(error);