diff --git a/deno/payloads/v8/_interactions/modalSubmit.ts b/deno/payloads/v8/_interactions/modalSubmit.ts new file mode 100644 index 00000000..c092492c --- /dev/null +++ b/deno/payloads/v8/_interactions/modalSubmit.ts @@ -0,0 +1,28 @@ +import type { APIActionRowComponent, APIModalComponent } from '../channel.ts'; +import type { APIBaseInteraction, InteractionType, ComponentType } from '../mod.ts'; + +export interface ModalSubmitComponent { + type: ComponentType; + custom_id: string; + value: string; +} + +export interface ModalSubmitActionRowComponent extends Omit, 'components'> { + components: ModalSubmitComponent[]; +} + +export interface APIModalSubmission { + /** + * A developer-defined identifier for the component, max 100 characters + */ + custom_id: string; + /** + * A list of child components + */ + components?: ModalSubmitActionRowComponent[]; +} + +/** + * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object + */ +export type APIModalSubmitInteraction = APIBaseInteraction; diff --git a/deno/payloads/v8/_interactions/responses.ts b/deno/payloads/v8/_interactions/responses.ts index 4edff842..160af94b 100644 --- a/deno/payloads/v8/_interactions/responses.ts +++ b/deno/payloads/v8/_interactions/responses.ts @@ -1,6 +1,7 @@ import type { MessageFlags } from '../mod.ts'; import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts'; import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts'; +import type { APIActionRowComponent, APIModalComponent } from '../channel.ts'; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type @@ -10,6 +11,7 @@ export enum InteractionType { ApplicationCommand, MessageComponent, ApplicationCommandAutocomplete, + ModalSubmit, } /** @@ -32,6 +34,11 @@ export interface APIApplicationCommandAutocompleteResponse { data: APICommandAutocompleteInteractionResponseCallbackData; } +export interface APIModalInteractionResponse { + type: InteractionResponseType.Modal; + data: APIModalInteractionResponseCallbackData; +} + export interface APIInteractionResponseChannelMessageWithSource { type: InteractionResponseType.ChannelMessageWithSource; data: APIInteractionResponseCallbackData; @@ -79,6 +86,10 @@ export enum InteractionResponseType { * For autocomplete interactions */ ApplicationCommandAutocompleteResult, + /** + * Respond to an interaction with an modal for a user to fill-out + */ + Modal, } /** @@ -92,3 +103,21 @@ export type APIInteractionResponseCallbackData = Omit< 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[]; +} diff --git a/deno/payloads/v8/channel.ts b/deno/payloads/v8/channel.ts index 621c1510..cd7e1768 100644 --- a/deno/payloads/v8/channel.ts +++ b/deno/payloads/v8/channel.ts @@ -3,10 +3,10 @@ */ import type { Permissions, Snowflake } from '../../globals.ts'; +import type { APIApplication } from './application.ts'; import type { APIPartialEmoji } from './emoji.ts'; import type { APIGuildMember } from './guild.ts'; import type { APIMessageInteraction } from './interactions.ts'; -import type { APIApplication } from './application.ts'; import type { APIRole } from './permissions.ts'; import type { APISticker, APIStickerItem } from './sticker.ts'; import type { APIUser } from './user.ts'; @@ -406,7 +406,7 @@ export interface APIMessage { /** * Sent if the message contains components like buttons, action rows, or other interactive components */ - components?: APIActionRowComponent[]; + components?: APIActionRowComponent[]; /** * Sent if the message contains stickers * @@ -976,7 +976,7 @@ export interface APIAllowedMentions { /** * https://discord.com/developers/docs/interactions/message-components#component-object */ -export interface APIBaseMessageComponent { +export interface APIBaseComponent { /** * The type of the component */ @@ -999,22 +999,27 @@ export enum ComponentType { * Select Menu component */ SelectMenu, + /** + * Text Input component + */ + TextInput, } /** * https://discord.com/developers/docs/interactions/message-components#action-rows */ -export interface APIActionRowComponent extends APIBaseMessageComponent { +export interface APIActionRowComponent + extends APIBaseComponent { /** * The components in the ActionRow */ - components: Exclude[]; + components: Exclude>[]; } /** * https://discord.com/developers/docs/interactions/message-components#buttons */ -interface APIButtonComponentBase