Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(APIInteraction): add modal submit interaction & make data required in APIModalSubmit #321

Merged
merged 4 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion deno/payloads/v8/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit.ts';

export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
Expand All @@ -25,7 +26,8 @@ export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
| APIApplicationCommandAutocompleteInteraction
| APIModalSubmitInteraction;

almeidx marked this conversation as resolved.
Show resolved Hide resolved
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand Down
4 changes: 3 additions & 1 deletion deno/payloads/v9/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit.ts';

export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
Expand All @@ -25,7 +26,8 @@ export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
| APIApplicationCommandAutocompleteInteraction
| APIModalSubmitInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand Down
4 changes: 3 additions & 1 deletion payloads/v8/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit';

export * from './_interactions/base';
export * from './_interactions/messageComponents';
Expand All @@ -25,7 +26,8 @@ export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
| APIApplicationCommandAutocompleteInteraction
| APIModalSubmitInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand Down
4 changes: 3 additions & 1 deletion payloads/v9/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit';

export * from './_interactions/base';
export * from './_interactions/messageComponents';
Expand All @@ -25,7 +26,8 @@ export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
| APIApplicationCommandAutocompleteInteraction
| APIModalSubmitInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand Down
5 changes: 5 additions & 0 deletions tests/v9/interactions.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
APIInteraction,
APIInteractionGuildMember,
APIMessageComponentInteraction,
APIModalSubmission,
APIUser,
ComponentType,
InteractionType,
Expand Down Expand Up @@ -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);
Expand Down