From 9e7a619c24b98a20eb232859ed7866b3518853f4 Mon Sep 17 00:00:00 2001 From: Lucas K Date: Thu, 6 Oct 2022 22:31:11 +0200 Subject: [PATCH] Fix slashCommand of type SUB_COMMAND_GROUP I tried to run a slash command like this: this.channel.sendSlash(BOT_ID, 'trade item for_items', '1', 'itemName', 'True'); I ran into an exception saying "Cannot read properties of undefined (reading 'type')" After debugging it, I got it working again with this small adjustment. --- src/structures/ApplicationCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index e1dfadd..ec46bfe 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -697,7 +697,7 @@ class ApplicationCommand extends Base { const subGroup = this.options.find( o => o.name == subCommandArray[0] && o.type == 'SUB_COMMAND_GROUP', ); - const subCommand = this.options.find(o => o.name == subCommandArray[1] && o.type == 'SUB_COMMAND'); + const subCommand = subGroup.options.find(o => o.name == subCommandArray[1] && o.type == 'SUB_COMMAND'); optionsBuild = [ { type: ApplicationCommandOptionTypes[subGroup.type],