feat: entry point commands and interaction callback response (#1077)

This commit is contained in:
Almeida
2024-09-05 16:29:23 +01:00
committed by GitHub
parent 3de4ca8933
commit b4b70d8bdc
13 changed files with 567 additions and 0 deletions

View File

@@ -35,6 +35,9 @@
"RESTAPIGuildCreateRole",
"RESTAPIGuildOnboardingPrompt",
"RESTAPIGuildOnboardingPromptOption",
"RESTAPIInteractionCallbackActivityInstanceResource",
"RESTAPIInteractionCallbackObject",
"RESTAPIInteractionCallbackResourceObject",
"RESTAPIMessageReference",
"RESTAPIPartialCurrentUserGuild",
"RESTAPIPoll",

View File

@@ -102,15 +102,35 @@ export interface APIApplicationCommand {
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
/**
* Determines whether the interaction is handled by the app's interactions handler or by Discord
*
* @remarks
* This is only available for {@link ApplicationCommandType.PrimaryEntryPoint} commands
*/
handler?: EntryPointCommandHandlerType;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
/**
* Slash commands; a text-based command that shows up when a user types `/`
*/
ChatInput = 1,
/**
* A UI-based command that shows up when you right click or tap on a user
*/
User,
/**
* A UI-based command that shows up when you right click or tap on a message
*/
Message,
/**
* A UI-based command that represents the primary way to invoke an app's Activity
*/
PrimaryEntryPoint,
}
/**
@@ -145,6 +165,21 @@ export enum InteractionContextType {
PrivateChannel,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
*/
export enum EntryPointCommandHandlerType {
/**
* The app handles the interaction using an interaction token
*/
AppHandler = 1,
/**
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with
* the app
*/
DiscordLaunchActivity,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/

View File

@@ -102,6 +102,14 @@ export enum InteractionResponseType {
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
*/
PremiumRequired,
/**
* Launch the Activity associated with the app.
*
* @remarks
* Only available for apps with Activities enabled
*/
LaunchActivity = 12,
}
/**

View File

@@ -102,15 +102,35 @@ export interface APIApplicationCommand {
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
/**
* Determines whether the interaction is handled by the app's interactions handler or by Discord
*
* @remarks
* This is only available for {@link ApplicationCommandType.PrimaryEntryPoint} commands
*/
handler?: EntryPointCommandHandlerType;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
/**
* Slash commands; a text-based command that shows up when a user types `/`
*/
ChatInput = 1,
/**
* A UI-based command that shows up when you right click or tap on a user
*/
User,
/**
* A UI-based command that shows up when you right click or tap on a message
*/
Message,
/**
* A UI-based command that represents the primary way to invoke an app's Activity
*/
PrimaryEntryPoint,
}
/**
@@ -145,6 +165,21 @@ export enum InteractionContextType {
PrivateChannel,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
*/
export enum EntryPointCommandHandlerType {
/**
* The app handles the interaction using an interaction token
*/
AppHandler = 1,
/**
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with
* the app
*/
DiscordLaunchActivity,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/

View File

@@ -102,6 +102,14 @@ export enum InteractionResponseType {
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
*/
PremiumRequired,
/**
* Launch the Activity associated with the app.
*
* @remarks
* Only available for apps with Activities enabled
*/
LaunchActivity = 12,
}
/**

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIApplicationCommand,
APIApplicationCommandPermission,
@@ -5,6 +6,9 @@ import type {
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
InteractionResponseType,
APIMessage,
InteractionType,
} from '../../payloads/v10/mod.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -171,6 +175,16 @@ export type RESTPutAPIApplicationGuildCommandsResult = Omit<APIApplicationComman
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export interface RESTPostAPIInteractionCallbackQuery {
/**
* Whether to include a interaction callback response as the response instead of a 204
*/
with_response?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
@@ -183,6 +197,90 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
})
| (Record<`files[${bigint}]`, unknown> & RESTPostAPIInteractionCallbackJSONBody);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackResult = never;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
*/
export interface RESTPostAPIInteractionCallbackWithResponseResult {
/**
* The interaction object associated with the interaction
*/
interaction: RESTAPIInteractionCallbackObject;
/**
* The resource that was created by the interaction response
*/
resource?: RESTAPIInteractionCallbackResourceObject;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
*/
export interface RESTAPIInteractionCallbackObject {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* Interaction type
*/
type: InteractionType;
/**
* Instance ID of the Activity if one was launched or joined
*/
activity_instance_id?: string;
/**
* ID of the message that was created by the interaction
*/
response_message_id?: Snowflake;
/**
* Whether or not the message is in a loading state
*/
response_message_loading?: boolean;
/**
* Whether or not the response message was ephemeral
*/
response_message_ephemeral?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
*/
export interface RESTAPIInteractionCallbackResourceObject {
/**
* Interaction callback type
*/
type: InteractionResponseType;
/**
* Represents the Activity launched by this interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.LaunchActivity}
*/
activity_instance?: RESTAPIInteractionCallbackActivityInstanceResource;
/**
* Message created by the interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.ChannelMessageWithSource}
* or {@link InteractionResponseType.UpdateMessage}
*/
message?: APIMessage;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
*/
export interface RESTAPIInteractionCallbackActivityInstanceResource {
/**
* Instance ID of the Activity if one was launched or joined.
*/
id: string;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIApplicationCommand,
APIApplicationCommandPermission,
@@ -5,6 +6,9 @@ import type {
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
InteractionResponseType,
APIMessage,
InteractionType,
} from '../../payloads/v9/mod.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -171,6 +175,16 @@ export type RESTPutAPIApplicationGuildCommandsResult = Omit<APIApplicationComman
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export interface RESTPostAPIInteractionCallbackQuery {
/**
* Whether to include a interaction callback response as the response instead of a 204
*/
with_response?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
@@ -183,6 +197,90 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
})
| (Record<`files[${bigint}]`, unknown> & RESTPostAPIInteractionCallbackJSONBody);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackResult = never;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
*/
export interface RESTPostAPIInteractionCallbackWithResponseResult {
/**
* The interaction object associated with the interaction
*/
interaction: RESTAPIInteractionCallbackObject;
/**
* The resource that was created by the interaction response
*/
resource?: RESTAPIInteractionCallbackResourceObject;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
*/
export interface RESTAPIInteractionCallbackObject {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* Interaction type
*/
type: InteractionType;
/**
* Instance ID of the Activity if one was launched or joined
*/
activity_instance_id?: string;
/**
* ID of the message that was created by the interaction
*/
response_message_id?: Snowflake;
/**
* Whether or not the message is in a loading state
*/
response_message_loading?: boolean;
/**
* Whether or not the response message was ephemeral
*/
response_message_ephemeral?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
*/
export interface RESTAPIInteractionCallbackResourceObject {
/**
* Interaction callback type
*/
type: InteractionResponseType;
/**
* Represents the Activity launched by this interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.LaunchActivity}
*/
activity_instance?: RESTAPIInteractionCallbackActivityInstanceResource;
/**
* Message created by the interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.ChannelMessageWithSource}
* or {@link InteractionResponseType.UpdateMessage}
*/
message?: APIMessage;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
*/
export interface RESTAPIInteractionCallbackActivityInstanceResource {
/**
* Instance ID of the Activity if one was launched or joined.
*/
id: string;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/

View File

@@ -102,15 +102,35 @@ export interface APIApplicationCommand {
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
/**
* Determines whether the interaction is handled by the app's interactions handler or by Discord
*
* @remarks
* This is only available for {@link ApplicationCommandType.PrimaryEntryPoint} commands
*/
handler?: EntryPointCommandHandlerType;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
/**
* Slash commands; a text-based command that shows up when a user types `/`
*/
ChatInput = 1,
/**
* A UI-based command that shows up when you right click or tap on a user
*/
User,
/**
* A UI-based command that shows up when you right click or tap on a message
*/
Message,
/**
* A UI-based command that represents the primary way to invoke an app's Activity
*/
PrimaryEntryPoint,
}
/**
@@ -145,6 +165,21 @@ export enum InteractionContextType {
PrivateChannel,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
*/
export enum EntryPointCommandHandlerType {
/**
* The app handles the interaction using an interaction token
*/
AppHandler = 1,
/**
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with
* the app
*/
DiscordLaunchActivity,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/

View File

@@ -102,6 +102,14 @@ export enum InteractionResponseType {
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
*/
PremiumRequired,
/**
* Launch the Activity associated with the app.
*
* @remarks
* Only available for apps with Activities enabled
*/
LaunchActivity = 12,
}
/**

View File

@@ -102,15 +102,35 @@ export interface APIApplicationCommand {
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
/**
* Determines whether the interaction is handled by the app's interactions handler or by Discord
*
* @remarks
* This is only available for {@link ApplicationCommandType.PrimaryEntryPoint} commands
*/
handler?: EntryPointCommandHandlerType;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
/**
* Slash commands; a text-based command that shows up when a user types `/`
*/
ChatInput = 1,
/**
* A UI-based command that shows up when you right click or tap on a user
*/
User,
/**
* A UI-based command that shows up when you right click or tap on a message
*/
Message,
/**
* A UI-based command that represents the primary way to invoke an app's Activity
*/
PrimaryEntryPoint,
}
/**
@@ -145,6 +165,21 @@ export enum InteractionContextType {
PrivateChannel,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
*/
export enum EntryPointCommandHandlerType {
/**
* The app handles the interaction using an interaction token
*/
AppHandler = 1,
/**
* Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with
* the app
*/
DiscordLaunchActivity,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
*/

View File

@@ -102,6 +102,14 @@ export enum InteractionResponseType {
* @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
*/
PremiumRequired,
/**
* Launch the Activity associated with the app.
*
* @remarks
* Only available for apps with Activities enabled
*/
LaunchActivity = 12,
}
/**

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals';
import type {
APIApplicationCommand,
APIApplicationCommandPermission,
@@ -5,6 +6,9 @@ import type {
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
InteractionResponseType,
APIMessage,
InteractionType,
} from '../../payloads/v10/index';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -171,6 +175,16 @@ export type RESTPutAPIApplicationGuildCommandsResult = Omit<APIApplicationComman
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export interface RESTPostAPIInteractionCallbackQuery {
/**
* Whether to include a interaction callback response as the response instead of a 204
*/
with_response?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
@@ -183,6 +197,90 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
})
| (Record<`files[${bigint}]`, unknown> & RESTPostAPIInteractionCallbackJSONBody);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackResult = never;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
*/
export interface RESTPostAPIInteractionCallbackWithResponseResult {
/**
* The interaction object associated with the interaction
*/
interaction: RESTAPIInteractionCallbackObject;
/**
* The resource that was created by the interaction response
*/
resource?: RESTAPIInteractionCallbackResourceObject;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
*/
export interface RESTAPIInteractionCallbackObject {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* Interaction type
*/
type: InteractionType;
/**
* Instance ID of the Activity if one was launched or joined
*/
activity_instance_id?: string;
/**
* ID of the message that was created by the interaction
*/
response_message_id?: Snowflake;
/**
* Whether or not the message is in a loading state
*/
response_message_loading?: boolean;
/**
* Whether or not the response message was ephemeral
*/
response_message_ephemeral?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
*/
export interface RESTAPIInteractionCallbackResourceObject {
/**
* Interaction callback type
*/
type: InteractionResponseType;
/**
* Represents the Activity launched by this interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.LaunchActivity}
*/
activity_instance?: RESTAPIInteractionCallbackActivityInstanceResource;
/**
* Message created by the interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.ChannelMessageWithSource}
* or {@link InteractionResponseType.UpdateMessage}
*/
message?: APIMessage;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
*/
export interface RESTAPIInteractionCallbackActivityInstanceResource {
/**
* Instance ID of the Activity if one was launched or joined.
*/
id: string;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals';
import type {
APIApplicationCommand,
APIApplicationCommandPermission,
@@ -5,6 +6,9 @@ import type {
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
InteractionResponseType,
APIMessage,
InteractionType,
} from '../../payloads/v9/index';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -171,6 +175,16 @@ export type RESTPutAPIApplicationGuildCommandsResult = Omit<APIApplicationComman
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export interface RESTPostAPIInteractionCallbackQuery {
/**
* Whether to include a interaction callback response as the response instead of a 204
*/
with_response?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
@@ -183,6 +197,90 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
})
| (Record<`files[${bigint}]`, unknown> & RESTPostAPIInteractionCallbackJSONBody);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackResult = never;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
*/
export interface RESTPostAPIInteractionCallbackWithResponseResult {
/**
* The interaction object associated with the interaction
*/
interaction: RESTAPIInteractionCallbackObject;
/**
* The resource that was created by the interaction response
*/
resource?: RESTAPIInteractionCallbackResourceObject;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
*/
export interface RESTAPIInteractionCallbackObject {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* Interaction type
*/
type: InteractionType;
/**
* Instance ID of the Activity if one was launched or joined
*/
activity_instance_id?: string;
/**
* ID of the message that was created by the interaction
*/
response_message_id?: Snowflake;
/**
* Whether or not the message is in a loading state
*/
response_message_loading?: boolean;
/**
* Whether or not the response message was ephemeral
*/
response_message_ephemeral?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
*/
export interface RESTAPIInteractionCallbackResourceObject {
/**
* Interaction callback type
*/
type: InteractionResponseType;
/**
* Represents the Activity launched by this interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.LaunchActivity}
*/
activity_instance?: RESTAPIInteractionCallbackActivityInstanceResource;
/**
* Message created by the interaction
*
* @remarks
* Only present if `type` is {@link InteractionResponseType.ChannelMessageWithSource}
* or {@link InteractionResponseType.UpdateMessage}
*/
message?: APIMessage;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
*/
export interface RESTAPIInteractionCallbackActivityInstanceResource {
/**
* Instance ID of the Activity if one was launched or joined.
*/
id: string;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/