mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types: fix interaction typeguards (#6976)
This commit is contained in:
41
typings/index.d.ts
vendored
41
typings/index.d.ts
vendored
@@ -334,9 +334,9 @@ export abstract class BaseCommandInteraction<Cached extends CacheType = CacheTyp
|
||||
public ephemeral: boolean | null;
|
||||
public replied: boolean;
|
||||
public webhook: InteractionWebhook;
|
||||
public inGuild(): this is BaseCommandInteraction<'present'> & this;
|
||||
public inCachedGuild(): this is BaseCommandInteraction<'cached'> & this;
|
||||
public inRawGuild(): this is BaseCommandInteraction<'raw'> & this;
|
||||
public inGuild(): this is BaseCommandInteraction<'present'>;
|
||||
public inCachedGuild(): this is BaseCommandInteraction<'cached'>;
|
||||
public inRawGuild(): this is BaseCommandInteraction<'raw'>;
|
||||
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||
public deleteReply(): Promise<void>;
|
||||
@@ -444,6 +444,9 @@ export class BitField<S extends string, N extends number | bigint = number> {
|
||||
export class ButtonInteraction<Cached extends CacheType = CacheType> extends MessageComponentInteraction<Cached> {
|
||||
private constructor(client: Client, data: RawMessageButtonInteractionData);
|
||||
public componentType: 'BUTTON';
|
||||
public inGuild(): this is ButtonInteraction<'present'>;
|
||||
public inCachedGuild(): this is ButtonInteraction<'cached'>;
|
||||
public inRawGuild(): this is ButtonInteraction<'raw'>;
|
||||
}
|
||||
|
||||
export class CategoryChannel extends GuildChannel {
|
||||
@@ -671,9 +674,9 @@ export interface ApplicationCommandInteractionOptionResolver<Cached extends Cach
|
||||
|
||||
export class CommandInteraction<Cached extends CacheType = CacheType> extends BaseCommandInteraction<Cached> {
|
||||
public options: Omit<CommandInteractionOptionResolver<Cached>, 'getMessage' | 'getFocused'>;
|
||||
public inGuild(): this is CommandInteraction<'present'> & this;
|
||||
public inCachedGuild(): this is CommandInteraction<'cached'> & this;
|
||||
public inRawGuild(): this is CommandInteraction<'raw'> & this;
|
||||
public inGuild(): this is CommandInteraction<'present'>;
|
||||
public inCachedGuild(): this is CommandInteraction<'cached'>;
|
||||
public inRawGuild(): this is CommandInteraction<'raw'>;
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
@@ -684,9 +687,9 @@ export class AutocompleteInteraction<Cached extends CacheType = CacheType> exten
|
||||
public commandName: string;
|
||||
public responded: boolean;
|
||||
public options: Omit<CommandInteractionOptionResolver<Cached>, 'getMessage'>;
|
||||
public inGuild(): this is CommandInteraction<'present'> & this;
|
||||
public inCachedGuild(): this is CommandInteraction<'cached'> & this;
|
||||
public inRawGuild(): this is CommandInteraction<'raw'> & this;
|
||||
public inGuild(): this is AutocompleteInteraction<'present'>;
|
||||
public inCachedGuild(): this is AutocompleteInteraction<'cached'>;
|
||||
public inRawGuild(): this is AutocompleteInteraction<'raw'>;
|
||||
private transformOption(option: APIApplicationCommandOption): CommandInteractionOption;
|
||||
public respond(options: ApplicationCommandOptionChoice[]): Promise<void>;
|
||||
}
|
||||
@@ -765,6 +768,9 @@ export class ContextMenuInteraction<Cached extends CacheType = CacheType> extend
|
||||
>;
|
||||
public targetId: Snowflake;
|
||||
public targetType: Exclude<ApplicationCommandType, 'CHAT_INPUT'>;
|
||||
public inGuild(): this is ContextMenuInteraction<'present'>;
|
||||
public inCachedGuild(): this is ContextMenuInteraction<'cached'>;
|
||||
public inRawGuild(): this is ContextMenuInteraction<'raw'>;
|
||||
private resolveContextMenuOptions(data: APIApplicationCommandInteractionData): CommandInteractionOption<Cached>[];
|
||||
}
|
||||
|
||||
@@ -1203,13 +1209,13 @@ export class Interaction<Cached extends CacheType = CacheType> extends Base {
|
||||
public user: User;
|
||||
public version: number;
|
||||
public memberPermissions: Readonly<Permissions> | null;
|
||||
public inGuild(): this is Interaction<'present'> & this;
|
||||
public inCachedGuild(): this is Interaction<'cached'> & this;
|
||||
public inRawGuild(): this is Interaction<'raw'> & this;
|
||||
public inGuild(): this is Interaction<'present'>;
|
||||
public inCachedGuild(): this is Interaction<'cached'>;
|
||||
public inRawGuild(): this is Interaction<'raw'>;
|
||||
public isApplicationCommand(): this is BaseCommandInteraction<Cached>;
|
||||
public isButton(): this is ButtonInteraction<Cached>;
|
||||
public isCommand(): this is CommandInteraction<Cached>;
|
||||
public isAutocomplete(): this is AutocompleteInteraction;
|
||||
public isAutocomplete(): this is AutocompleteInteraction<Cached>;
|
||||
public isContextMenu(): this is ContextMenuInteraction<Cached>;
|
||||
public isMessageComponent(): this is MessageComponentInteraction<Cached>;
|
||||
public isSelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
@@ -1529,9 +1535,9 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
||||
public message: CacheTypeReducer<Cached, Message, APIMessage>;
|
||||
public replied: boolean;
|
||||
public webhook: InteractionWebhook;
|
||||
public inGuild(): this is MessageComponentInteraction<'present'> & this;
|
||||
public inCachedGuild(): this is MessageComponentInteraction<'cached'> & this;
|
||||
public inRawGuild(): this is MessageComponentInteraction<'raw'> & this;
|
||||
public inGuild(): this is MessageComponentInteraction<'present'>;
|
||||
public inCachedGuild(): this is MessageComponentInteraction<'cached'>;
|
||||
public inRawGuild(): this is MessageComponentInteraction<'raw'>;
|
||||
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||
@@ -1846,6 +1852,9 @@ export class SelectMenuInteraction<Cached extends CacheType = CacheType> extends
|
||||
public constructor(client: Client, data: RawMessageSelectMenuInteractionData);
|
||||
public componentType: 'SELECT_MENU';
|
||||
public values: string[];
|
||||
public inGuild(): this is SelectMenuInteraction<'present'>;
|
||||
public inCachedGuild(): this is SelectMenuInteraction<'cached'>;
|
||||
public inRawGuild(): this is SelectMenuInteraction<'raw'>;
|
||||
}
|
||||
|
||||
export class Shard extends EventEmitter {
|
||||
|
||||
Reference in New Issue
Block a user