mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat: restore missing typeguards (#8328)
This commit is contained in:
@@ -193,6 +193,22 @@ class BaseInteraction extends Base {
|
||||
return Boolean(this.guildId && !this.guild && this.member);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is an {@link AutocompleteInteraction}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isAutocomplete() {
|
||||
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}
|
||||
@@ -212,6 +228,22 @@ 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}
|
||||
*/
|
||||
isModalSubmit() {
|
||||
return this.type === InteractionType.ModalSubmit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link UserContextMenuCommandInteraction}
|
||||
* @returns {boolean}
|
||||
|
||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -1527,9 +1527,13 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
||||
public inCachedGuild(): this is BaseInteraction<'cached'>;
|
||||
public inRawGuild(): this is BaseInteraction<'raw'>;
|
||||
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>;
|
||||
public isSelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
public isRepliable(): this is this & InteractionResponseFields<Cached>;
|
||||
|
||||
Reference in New Issue
Block a user