From 7c577411a246462246dee6fa9d8a3abb193dd22d Mon Sep 17 00:00:00 2001 From: MrSerge01 <86667481+MrSerge01@users.noreply.github.com> Date: Sat, 9 Nov 2024 21:26:32 +0500 Subject: [PATCH] I am an idiot --- src/events/interactionCreate.ts | 1 + src/handlers/commands.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index e5efaf6..cdb0c73 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -7,6 +7,7 @@ export default (async function run(interaction) { interaction.commandName, interaction.options ); + console.log(command); if (!command) return; if (interaction.isChatInputCommand()) command.run(interaction); diff --git a/src/handlers/commands.ts b/src/handlers/commands.ts index a134f5a..740c7c2 100644 --- a/src/handlers/commands.ts +++ b/src/handlers/commands.ts @@ -140,8 +140,10 @@ export class Commands { async getCommand(name: string, options: any) { const subcommandName = options.getSubcommand(false); - return subcommandName - ? subcommands.filter(subcommand => subcommand.data.name == subcommandName)[0] - : commands.filter(command => command.data.name == name)[0]; + + const command = commands.filter(command => command.data.name == name)[0]; + const subcommand = subcommands.filter(subcommand => subcommand.data.name == subcommandName)[0]; + if (!subcommand) return command; + return subcommand; } }