Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/structures/applicationCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ export class ApplicationCommandInteraction extends Interaction {

/** Gets sub command name from options */
get subCommand(): string | undefined {
if (this.data.options[0].type === ApplicationCommandOptionType.SUB_COMMAND)
if (
this.data.options?.[0]?.type === ApplicationCommandOptionType.SUB_COMMAND
)
return this.data.options[0].name
else if (
this.data.options[0].type ===
this.data.options?.[0]?.type ===
ApplicationCommandOptionType.SUB_COMMAND_GROUP &&
this.data.options[0].options?.[0].type ===
this.data.options?.[0]?.options?.[0]?.type ===
ApplicationCommandOptionType.SUB_COMMAND
)
return this.data.options[0].options[0].name
Expand All @@ -84,7 +86,7 @@ export class ApplicationCommandInteraction extends Interaction {
/** Gets sub command group name from options */
get subCommandGroup(): string | undefined {
if (
this.data.options[0].type ===
this.data.options?.[0]?.type ===
ApplicationCommandOptionType.SUB_COMMAND_GROUP
)
return this.data.options[0].name
Expand Down