Fixed bug with commands without public option
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user