feat(payloads): add entrypoint command payloads (#1166)

* feat: add entrypoint command payloads

* fix: data is present for entry point command interactions

* fix: missed export

* fix: lint

* fix: deno
This commit is contained in:
Naiyar
2024-12-20 01:13:27 +05:30
committed by GitHub
parent 61592d6a85
commit bcb13de75b
16 changed files with 232 additions and 20 deletions

View File

@@ -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>;

View File

@@ -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
@@ -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
@@ -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;

View File

@@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
@@ -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
*/

View File

@@ -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>;

View File

@@ -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
@@ -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
@@ -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;

View File

@@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
@@ -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
*/

View File

@@ -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

View File

@@ -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

View File

@@ -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>;

View File

@@ -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
@@ -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
@@ -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;

View File

@@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
@@ -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
*/

View File

@@ -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>;

View File

@@ -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
@@ -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
@@ -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;

View File

@@ -22,6 +22,7 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseLaunchActivity
| APIInteractionResponsePong
| APIInteractionResponseUpdateMessage
| APIModalInteractionResponse
@@ -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
*/

View File

@@ -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

View File

@@ -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