Skip to content

Commit

Permalink
I am an idiot
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerge01 committed Nov 9, 2024
1 parent 213cbe3 commit 7c57741
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/events/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions src/handlers/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 7c57741

Please sign in to comment.