ModalContext
Represents a context for interacting with components in a Discord bot.
Signature
export interface ModalContext extends BaseContext, ExtendContextProperties
13Methods
36Properties
readonly client: UsingClient;interaction: ModalSubmitInteraction;command: ModalCommand;metadata: CommandMetadata<M>;globalMetadata: GlobalMetadata;componentsGetterget components(): { type: ComponentType.Label; id?: number | undefined; component?: { type: ComponentType.FileUpload; values: string[]; id?: number | undefined; customId: string; } | { type: ComponentType.RadioGroup; value: string; id?: number | undefined; customId: string; } | { type: ComponentType.CheckboxGroup; values: string[]; id?: number | undefined; customId: string; } | { type: ComponentType.Checkbox; value: boolean; id?: number | undefined; customId: string; } | { type: ComponentType.TextInput; value: string; id?: number | undefined; customId: string; } | { type: ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect; values: string[]; id?: number | undefined; customId: string; } | undefined;}[];customIdGetterget customId(): string;tGetterget t(): SeyfertLocale;Gets the language object for the interaction's locale.
guildIdGetterget guildId(): string | undefined;Gets the ID of the guild of the interaction.
channelIdGetterget channelId(): string;Gets the ID of the channel of the interaction.
authorGetterget author(): UserStructure;Gets the author of the interaction.
memberGetterget member(): InteractionGuildMemberStructure | undefined;Gets the member of the interaction.
proxyGetterget proxy(): APIRoutes;Gets the proxy object.
Methods
getChannels(customId: string, required: true): AllChannels[];getChannels(customId: string, required?: false): AllChannels[] | void;getRoles(customId: string, required: true): GuildRoleStructure[];getRoles(customId: string, required?: false): GuildRoleStructure[] | void;getUsers(customId: string, required: true): UserStructure[];getUsers(customId: string, required?: false): UserStructure[] | void;getMentionables(customId: string, required: true): (UserStructure | GuildRoleStructure | InteractionGuildMemberStructure)[];getMentionables(customId: string, required?: false): (UserStructure | GuildRoleStructure | InteractionGuildMemberStructure)[] | void;getRadioValues(customId: string, required: true): string;getRadioValues(customId: string, required?: false): string | void;getCheckboxValues(customId: string, required: true): string[];getCheckboxValues(customId: string, required?: false): string[] | void;getCheckbox(customId: string, required: true): boolean;getCheckbox(customId: string, required?: false): boolean | void;getInputValue(customId: string, required: true): string | string[];getInputValue(customId: string, required?: false): string | string[] | undefined;getFiles(customId: string, required: true): Attachment[];getFiles(customId: string, required?: false): Attachment[] | undefined;write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, void>>;Writes a response to the interaction.
body- The body of the response.
fetchReply- Whether to fetch the reply or not.
deferReply<FR extends boolean = false>(ephemeral?: boolean, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, undefined>>;Defers the reply to the interaction.
ephemeral- Whether the reply should be ephemeral or not.
update<WR extends boolean = false>(body: ComponentInteractionMessageUpdate, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, undefined>>;deferUpdate(): Promise<undefined>;editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>;Edits the response of the interaction.
body- The updated body of the response.
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, void>>;Edits the response or replies to the interaction.
body- The body of the response or updated body of the interaction.
fetchReply- Whether to fetch the reply or not.
followup(body: MessageWebhookCreateBodyRequest): Promise<WebhookMessageStructure>;fetchResponse(): Promise<WebhookMessageStructure>;A Promise that resolves to the fetched message
deleteResponse(): Promise<void>;Deletes the response of the interaction.
A promise that resolves when the response is deleted.
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;channel(mode: 'cache'): ReturnCache<AllChannels>;Gets the channel of the interaction.
mode- The mode to fetch the channel.
A promise that resolves to the channel.
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure | undefined>;me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>;Gets the bot member in the guild of the interaction.
mode- The mode to fetch the member.
A promise that resolves to the bot member.
guild(mode?: 'rest' | 'flow', query?: RESTGetAPIGuildQuery): Promise<GuildStructure<'cached' | 'api'> | undefined>;guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;Gets the guild of the interaction.
mode- The mode to fetch the guild.
A promise that resolves to the guild.
isModal(): this is ModalContext<M>;inGuild(): this is GuildModalContext<M>;isChat(): this is CommandContext;isMenu(): this is MenuCommandContext<UserCommandInteraction | MessageCommandInteraction>;isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;isComponent(): this is ComponentContext<keyof ContextComponentCommandInteractionMap>;isButton(): this is ComponentContext<'Button'>;isChannelSelectMenu(): this is ComponentContext<'ChannelSelect'>;isRoleSelectMenu(): this is ComponentContext<'RoleSelect'>;isMentionableSelectMenu(): this is ComponentContext<'MentionableSelect'>;isUserSelectMenu(): this is ComponentContext<'UserSelect'>;isStringSelectMenu(): this is ComponentContext<'StringSelect'>;isEntryPoint(): this is EntryPointContext;