Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Interaction): add isApplicationCommand check #6801

Merged
merged 4 commits into from Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -1119,6 +1119,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