Skip to content

Commit

Permalink
feat(Interaction): add isApplicationCommand check (#6801)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelvleeuwen committed Oct 12, 2021
1 parent 460df9e commit 6898fa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/structures/Interaction.js
Expand Up @@ -136,6 +136,14 @@ class Interaction extends Base {
return Boolean(this.guildId && !this.guild && this.member);
}

/**
* Indicates whether this interaction is a {@link BaseCommandInteraction}.
* @returns {boolean}
*/
isApplicationCommand() {
return InteractionTypes[this.type] === InteractionTypes.APPLICATION_COMMAND;
}

/**
* Indicates whether this interaction is a {@link CommandInteraction}.
* @returns {boolean}
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -1120,6 +1120,7 @@ export class Interaction extends Base {
public inGuild(): this is GuildInteraction<'present'> & this;
public inCachedGuild(): this is GuildInteraction<'cached'> & this;
public inRawGuild(): this is GuildInteraction<'raw'> & this;
public isApplicationCommand(): this is BaseCommandInteraction;
public isButton(): this is ButtonInteraction;
public isCommand(): this is CommandInteraction;
public isContextMenu(): this is ContextMenuInteraction;
Expand Down

0 comments on commit 6898fa3

Please sign in to comment.