Skip to main content
Module

x/discord_api_types/payloads/v10/_interactions/responses.ts

Up to date Discord API Typings, versioned by the API version
Go to Latest
File
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10.ts';import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';import type { MessageFlags } from '../mod.ts';
/** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type */export enum InteractionType { Ping = 1, ApplicationCommand, MessageComponent, ApplicationCommandAutocomplete, ModalSubmit,}
/** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object */export type APIInteractionResponse = | APIInteractionResponsePong | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponseUpdateMessage | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse;
export interface APIInteractionResponsePong { type: InteractionResponseType.Pong;}
export interface APIApplicationCommandAutocompleteResponse { type: InteractionResponseType.ApplicationCommandAutocompleteResult; data: APICommandAutocompleteInteractionResponseCallbackData;}
export interface APIModalInteractionResponse { type: InteractionResponseType.Modal; data: APIModalInteractionResponseCallbackData;}
export interface APIInteractionResponseChannelMessageWithSource { type: InteractionResponseType.ChannelMessageWithSource; data: APIInteractionResponseCallbackData;}
export interface APIInteractionResponseDeferredChannelMessageWithSource { type: InteractionResponseType.DeferredChannelMessageWithSource; data?: Pick<APIInteractionResponseCallbackData, 'flags'>;}
export interface APIInteractionResponseDeferredMessageUpdate { type: InteractionResponseType.DeferredMessageUpdate;}
export interface APIInteractionResponseUpdateMessage { type: InteractionResponseType.UpdateMessage; data?: APIInteractionResponseCallbackData;}
/** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type */export enum InteractionResponseType { /** * ACK a `Ping` */ Pong = 1, /** * Respond to an interaction with a message */ ChannelMessageWithSource = 4, /** * ACK an interaction and edit to a response later, the user sees a loading state */ DeferredChannelMessageWithSource, /** * ACK a button interaction and update it to a loading state */ DeferredMessageUpdate, /** * ACK a button interaction and edit the message to which the button was attached */ UpdateMessage, /** * For autocomplete interactions */ ApplicationCommandAutocompleteResult, /** * Respond to an interaction with an modal for a user to fill-out */ Modal,}
/** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure */export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, 'username' | 'avatar_url'> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData { choices?: APIApplicationCommandOptionChoice[];}
/** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal */export interface APIModalInteractionResponseCallbackData { /** * A developer-defined identifier for the component, max 100 characters */ custom_id: string; /** * The title of the popup modal */ title: string; /** * Between 1 and 5 (inclusive) components that make up the modal */ components: APIActionRowComponent<APIModalActionRowComponent>[];}