mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-30 23:40:09 +00:00
fix(APIInteraction): add modal submit interaction & make data required in APIModalSubmit (#321)
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import type { APIActionRowComponent, APIModalComponent } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType, ComponentType } from '../mod.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
@@ -25,4 +31,15 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>;
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
@@ -10,6 +10,11 @@ import type {
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
@@ -25,14 +30,21 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import type { APIActionRowComponent, APIModalComponent } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType, ComponentType } from '../mod.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
@@ -25,4 +31,15 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>;
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
@@ -10,6 +10,11 @@ import type {
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
@@ -25,14 +30,21 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import type { APIActionRowComponent, APIModalComponent } from '../channel';
|
||||
import type { APIBaseInteraction, InteractionType, ComponentType } from '../index';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
@@ -25,4 +31,15 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>;
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
@@ -10,6 +10,11 @@ import type {
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit';
|
||||
|
||||
export * from './_interactions/base';
|
||||
export * from './_interactions/messageComponents';
|
||||
@@ -25,14 +30,21 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import type { APIActionRowComponent, APIModalComponent } from '../channel';
|
||||
import type { APIBaseInteraction, InteractionType, ComponentType } from '../index';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
@@ -25,4 +31,15 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>;
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
@@ -10,6 +10,11 @@ import type {
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit';
|
||||
|
||||
export * from './_interactions/base';
|
||||
export * from './_interactions/messageComponents';
|
||||
@@ -25,14 +30,21 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
APIInteraction,
|
||||
APIInteractionGuildMember,
|
||||
APIMessageComponentInteraction,
|
||||
APIModalSubmission,
|
||||
APIUser,
|
||||
ComponentType,
|
||||
InteractionType,
|
||||
@@ -37,6 +38,10 @@ if (interaction.type === InteractionType.MessageComponent) {
|
||||
}
|
||||
}
|
||||
|
||||
if (interaction.type === InteractionType.ModalSubmit) {
|
||||
expectType<APIModalSubmission>(interaction.data);
|
||||
}
|
||||
|
||||
declare const dmInteraction: APIDMInteraction;
|
||||
|
||||
expectType<APIUser>(dmInteraction.user);
|
||||
|
||||
Reference in New Issue
Block a user