Skip to content

Commit

Permalink
feat(payloads): add entrypoint command payloads (#1166)
Browse files Browse the repository at this point in the history
* feat: add entrypoint command payloads

* fix: data is present for entry point command interactions

* fix: missed export

* fix: lint

* fix: deno
  • Loading branch information
imnaiyar authored Dec 19, 2024
1 parent 61592d6 commit bcb13de
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 20 deletions.
26 changes: 26 additions & 0 deletions deno/payloads/v10/_interactions/_applicationCommands/entryPoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/
export type APIPrimaryEntryPointCommandInteractionData =
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandInteraction =
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandGuildInteraction =
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21 changes: 17 additions & 4 deletions deno/payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ import type {
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
import type {
APIPrimaryEntryPointCommandDMInteraction,
APIPrimaryEntryPointCommandGuildInteraction,
APIPrimaryEntryPointCommandInteraction,
APIPrimaryEntryPointCommandInteractionData,
} from './_applicationCommands/entryPoint.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';

export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
export * from './_applicationCommands/entryPoint.ts';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
Expand Down Expand Up @@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
| APIContextMenuInteractionData
| APIPrimaryEntryPointCommandInteractionData;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand All @@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
export type APIApplicationCommandInteraction =
| APIChatInputApplicationCommandInteraction
| APIContextMenuInteraction
| APIPrimaryEntryPointCommandInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
| APIContextMenuDMInteraction
| APIPrimaryEntryPointCommandDMInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;
| APIContextMenuGuildInteraction
| APIPrimaryEntryPointCommandGuildInteraction;
5 changes: 5 additions & 0 deletions deno/payloads/v10/_interactions/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
Expand Down Expand Up @@ -64,6 +65,10 @@ export interface APIInteractionResponseUpdateMessage {
data?: APIInteractionResponseCallbackData;
}

export interface APIInteractionResponseLaunchActivity {
type: InteractionResponseType.LaunchActivity;
}

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
Expand Down
26 changes: 26 additions & 0 deletions deno/payloads/v9/_interactions/_applicationCommands/entryPoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/
export type APIPrimaryEntryPointCommandInteractionData =
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandInteraction =
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandGuildInteraction =
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21 changes: 17 additions & 4 deletions deno/payloads/v9/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ import type {
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
import type {
APIPrimaryEntryPointCommandDMInteraction,
APIPrimaryEntryPointCommandGuildInteraction,
APIPrimaryEntryPointCommandInteraction,
APIPrimaryEntryPointCommandInteractionData,
} from './_applicationCommands/entryPoint.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';

export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
export * from './_applicationCommands/entryPoint.ts';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
Expand Down Expand Up @@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
| APIContextMenuInteractionData
| APIPrimaryEntryPointCommandInteractionData;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand All @@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
export type APIApplicationCommandInteraction =
| APIChatInputApplicationCommandInteraction
| APIContextMenuInteraction
| APIPrimaryEntryPointCommandInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
| APIContextMenuDMInteraction
| APIPrimaryEntryPointCommandDMInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;
| APIContextMenuGuildInteraction
| APIPrimaryEntryPointCommandGuildInteraction;
5 changes: 5 additions & 0 deletions deno/payloads/v9/_interactions/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
Expand Down Expand Up @@ -64,6 +65,10 @@ export interface APIInteractionResponseUpdateMessage {
data?: APIInteractionResponseCallbackData;
}

export interface APIInteractionResponseLaunchActivity {
type: InteractionResponseType.LaunchActivity;
}

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
Expand Down
11 changes: 10 additions & 1 deletion deno/rest/v10/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
type: ApplicationCommandType.Message | ApplicationCommandType.User;
}

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.PrimaryEntryPoint;
}

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
| RESTPostAPIContextMenuApplicationCommandsJSONBody
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
Expand Down
11 changes: 10 additions & 1 deletion deno/rest/v9/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
type: ApplicationCommandType.Message | ApplicationCommandType.User;
}

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.PrimaryEntryPoint;
}

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
| RESTPostAPIContextMenuApplicationCommandsJSONBody
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;

/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
Expand Down
26 changes: 26 additions & 0 deletions payloads/v10/_interactions/_applicationCommands/entryPoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type { APIBaseApplicationCommandInteractionData } from './internals';

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/
export type APIPrimaryEntryPointCommandInteractionData =
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandInteraction =
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandGuildInteraction =
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21 changes: 17 additions & 4 deletions payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ import type {
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu';
import type {
APIPrimaryEntryPointCommandDMInteraction,
APIPrimaryEntryPointCommandGuildInteraction,
APIPrimaryEntryPointCommandInteraction,
APIPrimaryEntryPointCommandInteractionData,
} from './_applicationCommands/entryPoint';
import type { APIBaseInteraction } from './base';
import type { InteractionType } from './responses';

export * from './_applicationCommands/chatInput';
export * from './_applicationCommands/contextMenu';
export * from './_applicationCommands/permissions';
export * from './_applicationCommands/entryPoint';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
Expand Down Expand Up @@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
| APIContextMenuInteractionData
| APIPrimaryEntryPointCommandInteractionData;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
Expand All @@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
export type APIApplicationCommandInteraction =
| APIChatInputApplicationCommandInteraction
| APIContextMenuInteraction
| APIPrimaryEntryPointCommandInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
| APIContextMenuDMInteraction
| APIPrimaryEntryPointCommandDMInteraction;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;
| APIContextMenuGuildInteraction
| APIPrimaryEntryPointCommandGuildInteraction;
5 changes: 5 additions & 0 deletions payloads/v10/_interactions/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
Expand Down Expand Up @@ -64,6 +65,10 @@ export interface APIInteractionResponseUpdateMessage {
data?: APIInteractionResponseCallbackData;
}

export interface APIInteractionResponseLaunchActivity {
type: InteractionResponseType.LaunchActivity;
}

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
Expand Down
26 changes: 26 additions & 0 deletions payloads/v9/_interactions/_applicationCommands/entryPoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type { APIBaseApplicationCommandInteractionData } from './internals';

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/
export type APIPrimaryEntryPointCommandInteractionData =
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandInteraction =
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIPrimaryEntryPointCommandGuildInteraction =
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
Loading

0 comments on commit bcb13de

Please sign in to comment.