ModalContext

Represents a context for interacting with components in a Discord bot.

Signature

export interface ModalContext extends BaseContext, ExtendContext
JSDoc
@templateType - The type of component interaction.

Properties

get 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;}[];
tGetter
get t(): SeyfertLocale;

Gets the language object for the interaction's locale.

guildIdGetter
get guildId(): string | undefined;

Gets the ID of the guild of the interaction.

get channelId(): string;

Gets the ID of the channel of the interaction.

Methods

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;
deferReply<FR extends boolean = false>(ephemeral?: boolean, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, undefined>>;

Defers the reply to the interaction.

Parameters
ephemeral
Whether the reply should be ephemeral or not.
deleteResponse(): Promise<void>;

Deletes the response of the interaction.

Returns

A promise that resolves when the response is deleted.

channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;channel(mode: 'cache'): ReturnCache<AllChannels>;

Gets the channel of the interaction.

Parameters
mode
The mode to fetch the channel.
Returns

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.

Parameters
mode
The mode to fetch the member.
Returns

A promise that resolves to the bot member.