import type { AllChannels, ButtonInteraction, ChannelSelectMenuInteraction, ComponentCommand, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, StringSelectMenuInteraction, UserSelectMenuInteraction } from '..'; import type { ReturnCache } from '../cache'; import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStructure, MessageStructure, UserStructure, WebhookMessageStructure } from '../client/transformers'; import type { CommandMetadata, ExtendContext, GlobalMetadata, ResolvedRegisteredMiddlewares, UsingClient } from '../commands'; import { BaseContext } from '../commands/basecontext'; import type { ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, ModalCreateOptions, When } from '../common'; import type { ModalSubmitInteraction } from '../structures'; import { type RESTGetAPIGuildQuery } from '../types'; export interface ComponentContext extends BaseContext, ExtendContext { } export declare class ComponentContext extends BaseContext { readonly client: UsingClient; interaction: ContextComponentCommandInteractionMap[Type]; /** * Creates a new instance of the ComponentContext class. * @param client - The UsingClient instance. * @param interaction - The component interaction object. */ constructor(client: UsingClient, interaction: ContextComponentCommandInteractionMap[Type]); command: ComponentCommand; metadata: CommandMetadata; globalMetadata: GlobalMetadata; /** * Gets the language object for the interaction's locale. */ get t(): import("..").SeyfertLocale; /** * Gets the custom ID of the interaction. */ get customId(): string; get message(): MessageStructure; /** * Writes a response to the interaction. * @param body - The body of the response. * @param fetchReply - Whether to fetch the reply or not. */ write(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise>; /** * Defers the reply to the interaction. * @param ephemeral - Whether the reply should be ephemeral or not. */ deferReply(ephemeral?: boolean, fetchReply?: FR): Promise>; /** * ACK an interaction and edit the original message later; the user does not see a loading state */ deferUpdate(): Promise; update(body: ComponentInteractionMessageUpdate): Promise; /** * Edits the response or replies to the interaction. * @param body - The body of the response or updated body of the interaction. * @param fetchReply - Whether to fetch the reply or not. */ editOrReply(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise>; followup(body: MessageWebhookCreateBodyRequest): Promise; /** * @returns A Promise that resolves to the fetched message */ fetchResponse(): Promise; /** * Deletes the response of the interaction. * @returns A promise that resolves when the response is deleted. */ deleteResponse(): Promise; modal(body: ModalCreateBodyRequest, options?: undefined): Promise; modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise; /** * Gets the channel of the interaction. * @param mode - The mode to fetch the channel. * @returns A promise that resolves to the channel. */ channel(mode?: 'rest' | 'flow'): Promise; channel(mode: 'cache'): ReturnCache; /** * Gets the bot member in the guild of the interaction. * @param mode - The mode to fetch the member. * @returns A promise that resolves to the bot member. */ me(mode?: 'rest' | 'flow'): Promise; me(mode: 'cache'): ReturnCache; /** * Gets the guild of the interaction. * @param mode - The mode to fetch the guild. * @param query - Optional query used in fetch mode. * @returns A promise that resolves to the guild. */ guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise | undefined>; guild(mode: 'cache', query?: RESTGetAPIGuildQuery): ReturnCache | undefined>; /** * Gets the ID of the guild of the interaction. */ get guildId(): string | undefined; /** * Gets the ID of the channel of the interaction. */ get channelId(): string; /** * Gets the author of the interaction. */ get author(): UserStructure; /** * Gets the member of the interaction. */ get member(): InteractionGuildMemberStructure | undefined; isComponent(): this is ComponentContext; isButton(): this is ComponentContext<'Button', M, StringSelectValues>; isChannelSelectMenu(): this is ComponentContext<'ChannelSelect', M, StringSelectValues>; isRoleSelectMenu(): this is ComponentContext<'RoleSelect', M, StringSelectValues>; isMentionableSelectMenu(): this is ComponentContext<'MentionableSelect', M, StringSelectValues>; isUserSelectMenu(): this is ComponentContext<'UserSelect', M, StringSelectValues>; isStringSelectMenu(): this is ComponentContext<'StringSelect', M, StringSelectValues>; inGuild(): this is GuildComponentContext; } export interface ContextComponentCommandInteractionMap { Button: ButtonInteraction; StringSelect: StringSelectMenuInteraction; UserSelect: UserSelectMenuInteraction; RoleSelect: RoleSelectMenuInteraction; MentionableSelect: MentionableSelectMenuInteraction; ChannelSelect: ChannelSelectMenuInteraction; } export interface GuildComponentContext extends Omit, 'guildId' | 'member'>, 'guild' | 'me'> { guild(mode?: 'rest' | 'flow'): Promise>; guild(mode: 'cache'): ReturnCache | undefined>; me(mode?: 'rest' | 'flow'): Promise; me(mode: 'cache'): ReturnCache; }