Skip to content

Commit

Permalink
feat: and the other two
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Jul 21, 2022
1 parent dfabee2 commit d5e1861
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/discord.js/src/structures/BaseInteraction.js
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions packages/discord.js/typings/index.d.ts
Expand Up @@ -1527,7 +1527,9 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
public isButton(): this is ButtonInteraction<Cached>;
public isAutocomplete(): this is AutocompleteInteraction<Cached>;
public isChatInputCommand(): this is ChatInputCommandInteraction<Cached>;
public isCommand(): this is CommandInteraction<Cached>;
public isContextMenuCommand(): this is ContextMenuCommandInteraction<Cached>;
public isMessageComponent(): this is MessageComponentInteraction<Cached>;
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction<Cached>;
Expand Down

0 comments on commit d5e1861

Please sign in to comment.