Skip to content

Commit

Permalink
feat: add separate guild/dm interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Feb 11, 2022
1 parent e117561 commit 0625d46
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 16 deletions.
18 changes: 17 additions & 1 deletion deno/payloads/v8/_interactions/modalSubmit.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,3 +33,13 @@ export interface 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>;
16 changes: 13 additions & 3 deletions deno/payloads/v8/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit.ts';
import type {
APIModalSubmitDMInteraction,
APIModalSubmitGuildInteraction,
APIModalSubmitInteraction,
} from './_interactions/modalSubmit.ts';

export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
Expand All @@ -32,9 +36,15 @@ export type APIInteraction =
/**
* 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;
18 changes: 17 additions & 1 deletion deno/payloads/v9/_interactions/modalSubmit.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,3 +33,13 @@ export interface 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>;
16 changes: 13 additions & 3 deletions deno/payloads/v9/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit.ts';
import type {
APIModalSubmitDMInteraction,
APIModalSubmitGuildInteraction,
APIModalSubmitInteraction,
} from './_interactions/modalSubmit.ts';

export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
Expand All @@ -32,9 +36,15 @@ export type APIInteraction =
/**
* 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;
18 changes: 17 additions & 1 deletion payloads/v8/_interactions/modalSubmit.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,3 +33,13 @@ export interface 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>;
16 changes: 13 additions & 3 deletions payloads/v8/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit';
import type {
APIModalSubmitDMInteraction,
APIModalSubmitGuildInteraction,
APIModalSubmitInteraction,
} from './_interactions/modalSubmit';

export * from './_interactions/base';
export * from './_interactions/messageComponents';
Expand All @@ -32,9 +36,15 @@ export type APIInteraction =
/**
* 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;
18 changes: 17 additions & 1 deletion payloads/v9/_interactions/modalSubmit.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,3 +33,13 @@ export interface 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>;
16 changes: 13 additions & 3 deletions payloads/v9/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import type {
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
import type { APIModalSubmitInteraction } from './_interactions/modalSubmit';
import type {
APIModalSubmitDMInteraction,
APIModalSubmitGuildInteraction,
APIModalSubmitInteraction,
} from './_interactions/modalSubmit';

export * from './_interactions/base';
export * from './_interactions/messageComponents';
Expand All @@ -32,9 +36,15 @@ export type APIInteraction =
/**
* 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;

0 comments on commit 0625d46

Please sign in to comment.