diff --git a/packages/discord.js/src/structures/BaseInteraction.js b/packages/discord.js/src/structures/BaseInteraction.js index 97a9149fc84a..6177fb29ed12 100644 --- a/packages/discord.js/src/structures/BaseInteraction.js +++ b/packages/discord.js/src/structures/BaseInteraction.js @@ -201,6 +201,14 @@ class BaseInteraction extends Base { return this.type === InteractionType.ApplicationCommandAutocomplete; } + /** + * Indicates whether this interaction is a {@link CommandInteraction} + * @returns {boolean} + */ + isCommand() { + return this.type === InteractionType.ApplicationCommand; + } + /** * Indicates whether this interaction is a {@link ChatInputCommandInteraction}. * @returns {boolean} @@ -220,6 +228,14 @@ class BaseInteraction extends Base { ); } + /** + * Indicates whether this interaction is a {@link MessageComponentInteraction} + * @returns {boolean} + */ + isMessageComponent() { + return this.type === InteractionType.MessageComponent; + } + /** * Indicates whether this interaction is a {@link ModalSubmitInteraction} * @returns {boolean} diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index b2511e36c137..bf87e06b46e7 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -1527,7 +1527,9 @@ export class BaseInteraction extends Base public isButton(): this is ButtonInteraction; public isAutocomplete(): this is AutocompleteInteraction; public isChatInputCommand(): this is ChatInputCommandInteraction; + public isCommand(): this is CommandInteraction; public isContextMenuCommand(): this is ContextMenuCommandInteraction; + public isMessageComponent(): this is MessageComponentInteraction; public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction; public isModalSubmit(): this is ModalSubmitInteraction; public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction;