/** @module ModalSubmitInteraction */ import Interaction from "./Interaction"; import type Member from "./Member"; import type User from "./User"; import type Guild from "./Guild"; import Permission from "./Permission"; import type Message from "./Message"; import type PrivateChannel from "./PrivateChannel"; import { type InteractionTypes } from "../Constants"; import type { InteractionContent, ModalSubmitInteractionData, RawModalSubmitInteraction } from "../types/interactions"; import type Client from "../Client"; import type { AnyGuildTextChannel, AnyTextChannelWithoutGroup } from "../types/channels"; import type { JSONModalSubmitInteraction } from "../types/json"; import type { Uncached } from "../types/shared"; /** Represents a modal submit interaction. */ export default class ModalSubmitInteraction extends Interaction { private _cachedChannel; private _cachedGuild?; /** The permissions the bot has in the channel this interaction was sent from, if this interaction is sent from a guild. */ appPermissions: T extends AnyGuildTextChannel ? Permission : Permission | undefined; /** The ID of the channel this interaction was sent from. */ channelID: string; /** The data associated with the interaction. */ data: ModalSubmitInteractionData; /** The id of the guild this interaction was sent from, if applicable. */ guildID: T extends AnyGuildTextChannel ? string : string | null; /** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */ guildLocale: T extends AnyGuildTextChannel ? string : string | undefined; /** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */ locale: string; /** The member associated with the invoking user, if this interaction is sent from a guild. */ member: T extends AnyGuildTextChannel ? Member : Member | undefined; /** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */ memberPermissions: T extends AnyGuildTextChannel ? Permission : Permission | undefined; type: InteractionTypes.MODAL_SUBMIT; /** The user that invoked this interaction. */ user: User; constructor(data: RawModalSubmitInteraction, client: Client); /** The channel this interaction was sent from. */ get channel(): T extends AnyTextChannelWithoutGroup ? T : undefined; /** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */ get guild(): T extends AnyGuildTextChannel ? Guild : Guild | null; /** * Create a followup message. * @param options The options for creating the followup message. */ createFollowup(options: InteractionContent): Promise>; /** * Create a message through this interaction. This is an initial response, and more than one initial response cannot be used. Use `createFollowup`. * @param options The options for the message. */ createMessage(options: InteractionContent): Promise; /** * Defer this interaction. This is an initial response, and more than one initial response cannot be used. * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with. */ defer(flags?: number): Promise; /** * Defer this interaction with a `DEFERRED_UPDATE_MESSAGE` response. This is an initial response, and more than one initial response cannot be used. * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with. */ deferUpdate(flags?: number): Promise; /** * Delete a follow-up message. * @param messageID The ID of the message. */ deleteFollowup(messageID: string): Promise; /** * Delete the original interaction response. */ deleteOriginal(): Promise; /** * Edit a followup message. * @param messageID The ID of the message. * @param options The options for editing the followup message. */ editFollowup(messageID: string, options: InteractionContent): Promise>; /** * Edit the original interaction response. * @param options The options for editing the original message. */ editOriginal(options: InteractionContent): Promise>; /** * Edit the message this interaction is from. If this interaction has already been acknowledged, use `createFollowup`. * @param options The options for editing the message. */ editParent(options: InteractionContent): Promise; /** * Get a followup message. * @param messageID The ID of the message. */ getFollowup(messageID: string): Promise>; /** * Get the original interaction response. */ getOriginal(): Promise>; /** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */ inCachedGuildChannel(): this is ModalSubmitInteraction; /** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */ inPrivateChannel(): this is ModalSubmitInteraction; toJSON(): JSONModalSubmitInteraction; }