Skip to content

Commit bcb13de

Browse files
authored
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
1 parent 61592d6 commit bcb13de

File tree

16 files changed

+232
-20
lines changed

16 files changed

+232
-20
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
2+
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
3+
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
4+
5+
/**
6+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
7+
*/
8+
export type APIPrimaryEntryPointCommandInteractionData =
9+
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
10+
11+
/**
12+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
13+
*/
14+
export type APIPrimaryEntryPointCommandInteraction =
15+
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
16+
17+
/**
18+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
19+
*/
20+
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21+
22+
/**
23+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
24+
*/
25+
export type APIPrimaryEntryPointCommandGuildInteraction =
26+
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

deno/payloads/v10/_interactions/applicationCommands.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ import type {
1313
APIContextMenuInteraction,
1414
APIContextMenuInteractionData,
1515
} from './_applicationCommands/contextMenu.ts';
16+
import type {
17+
APIPrimaryEntryPointCommandDMInteraction,
18+
APIPrimaryEntryPointCommandGuildInteraction,
19+
APIPrimaryEntryPointCommandInteraction,
20+
APIPrimaryEntryPointCommandInteractionData,
21+
} from './_applicationCommands/entryPoint.ts';
1622
import type { APIBaseInteraction } from './base.ts';
1723
import type { InteractionType } from './responses.ts';
1824

1925
export * from './_applicationCommands/chatInput.ts';
2026
export * from './_applicationCommands/contextMenu.ts';
2127
export * from './_applicationCommands/permissions.ts';
28+
export * from './_applicationCommands/entryPoint.ts';
2229

2330
/**
2431
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
185192
*/
186193
export type APIApplicationCommandInteractionData =
187194
| APIChatInputApplicationCommandInteractionData
188-
| APIContextMenuInteractionData;
195+
| APIContextMenuInteractionData
196+
| APIPrimaryEntryPointCommandInteractionData;
189197

190198
/**
191199
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
202210
/**
203211
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
204212
*/
205-
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
213+
export type APIApplicationCommandInteraction =
214+
| APIChatInputApplicationCommandInteraction
215+
| APIContextMenuInteraction
216+
| APIPrimaryEntryPointCommandInteraction;
206217

207218
/**
208219
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
209220
*/
210221
export type APIApplicationCommandDMInteraction =
211222
| APIChatInputApplicationCommandDMInteraction
212-
| APIContextMenuDMInteraction;
223+
| APIContextMenuDMInteraction
224+
| APIPrimaryEntryPointCommandDMInteraction;
213225

214226
/**
215227
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
216228
*/
217229
export type APIApplicationCommandGuildInteraction =
218230
| APIChatInputApplicationCommandGuildInteraction
219-
| APIContextMenuGuildInteraction;
231+
| APIContextMenuGuildInteraction
232+
| APIPrimaryEntryPointCommandGuildInteraction;

deno/payloads/v10/_interactions/responses.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type APIInteractionResponse =
2222
| APIInteractionResponseChannelMessageWithSource
2323
| APIInteractionResponseDeferredChannelMessageWithSource
2424
| APIInteractionResponseDeferredMessageUpdate
25+
| APIInteractionResponseLaunchActivity
2526
| APIInteractionResponsePong
2627
| APIInteractionResponseUpdateMessage
2728
| APIModalInteractionResponse
@@ -64,6 +65,10 @@ export interface APIInteractionResponseUpdateMessage {
6465
data?: APIInteractionResponseCallbackData;
6566
}
6667

68+
export interface APIInteractionResponseLaunchActivity {
69+
type: InteractionResponseType.LaunchActivity;
70+
}
71+
6772
/**
6873
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
6974
*/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
2+
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
3+
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
4+
5+
/**
6+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
7+
*/
8+
export type APIPrimaryEntryPointCommandInteractionData =
9+
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
10+
11+
/**
12+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
13+
*/
14+
export type APIPrimaryEntryPointCommandInteraction =
15+
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
16+
17+
/**
18+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
19+
*/
20+
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21+
22+
/**
23+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
24+
*/
25+
export type APIPrimaryEntryPointCommandGuildInteraction =
26+
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

deno/payloads/v9/_interactions/applicationCommands.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ import type {
1313
APIContextMenuInteraction,
1414
APIContextMenuInteractionData,
1515
} from './_applicationCommands/contextMenu.ts';
16+
import type {
17+
APIPrimaryEntryPointCommandDMInteraction,
18+
APIPrimaryEntryPointCommandGuildInteraction,
19+
APIPrimaryEntryPointCommandInteraction,
20+
APIPrimaryEntryPointCommandInteractionData,
21+
} from './_applicationCommands/entryPoint.ts';
1622
import type { APIBaseInteraction } from './base.ts';
1723
import type { InteractionType } from './responses.ts';
1824

1925
export * from './_applicationCommands/chatInput.ts';
2026
export * from './_applicationCommands/contextMenu.ts';
2127
export * from './_applicationCommands/permissions.ts';
28+
export * from './_applicationCommands/entryPoint.ts';
2229

2330
/**
2431
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
185192
*/
186193
export type APIApplicationCommandInteractionData =
187194
| APIChatInputApplicationCommandInteractionData
188-
| APIContextMenuInteractionData;
195+
| APIContextMenuInteractionData
196+
| APIPrimaryEntryPointCommandInteractionData;
189197

190198
/**
191199
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
202210
/**
203211
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
204212
*/
205-
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
213+
export type APIApplicationCommandInteraction =
214+
| APIChatInputApplicationCommandInteraction
215+
| APIContextMenuInteraction
216+
| APIPrimaryEntryPointCommandInteraction;
206217

207218
/**
208219
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
209220
*/
210221
export type APIApplicationCommandDMInteraction =
211222
| APIChatInputApplicationCommandDMInteraction
212-
| APIContextMenuDMInteraction;
223+
| APIContextMenuDMInteraction
224+
| APIPrimaryEntryPointCommandDMInteraction;
213225

214226
/**
215227
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
216228
*/
217229
export type APIApplicationCommandGuildInteraction =
218230
| APIChatInputApplicationCommandGuildInteraction
219-
| APIContextMenuGuildInteraction;
231+
| APIContextMenuGuildInteraction
232+
| APIPrimaryEntryPointCommandGuildInteraction;

deno/payloads/v9/_interactions/responses.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type APIInteractionResponse =
2222
| APIInteractionResponseChannelMessageWithSource
2323
| APIInteractionResponseDeferredChannelMessageWithSource
2424
| APIInteractionResponseDeferredMessageUpdate
25+
| APIInteractionResponseLaunchActivity
2526
| APIInteractionResponsePong
2627
| APIInteractionResponseUpdateMessage
2728
| APIModalInteractionResponse
@@ -64,6 +65,10 @@ export interface APIInteractionResponseUpdateMessage {
6465
data?: APIInteractionResponseCallbackData;
6566
}
6667

68+
export interface APIInteractionResponseLaunchActivity {
69+
type: InteractionResponseType.LaunchActivity;
70+
}
71+
6772
/**
6873
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
6974
*/

deno/rest/v10/interactions.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
8383
type: ApplicationCommandType.Message | ApplicationCommandType.User;
8484
}
8585

86+
/**
87+
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
88+
*/
89+
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
90+
extends RESTPostAPIBaseApplicationCommandsJSONBody {
91+
type: ApplicationCommandType.PrimaryEntryPoint;
92+
}
93+
8694
/**
8795
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
8896
*/
8997
export type RESTPostAPIApplicationCommandsJSONBody =
9098
| RESTPostAPIChatInputApplicationCommandsJSONBody
91-
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
99+
| RESTPostAPIContextMenuApplicationCommandsJSONBody
100+
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
92101

93102
/**
94103
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command

deno/rest/v9/interactions.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
8383
type: ApplicationCommandType.Message | ApplicationCommandType.User;
8484
}
8585

86+
/**
87+
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
88+
*/
89+
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
90+
extends RESTPostAPIBaseApplicationCommandsJSONBody {
91+
type: ApplicationCommandType.PrimaryEntryPoint;
92+
}
93+
8694
/**
8795
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
8896
*/
8997
export type RESTPostAPIApplicationCommandsJSONBody =
9098
| RESTPostAPIChatInputApplicationCommandsJSONBody
91-
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
99+
| RESTPostAPIContextMenuApplicationCommandsJSONBody
100+
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
92101

93102
/**
94103
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
2+
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
3+
import type { APIBaseApplicationCommandInteractionData } from './internals';
4+
5+
/**
6+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
7+
*/
8+
export type APIPrimaryEntryPointCommandInteractionData =
9+
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
10+
11+
/**
12+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
13+
*/
14+
export type APIPrimaryEntryPointCommandInteraction =
15+
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
16+
17+
/**
18+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
19+
*/
20+
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
21+
22+
/**
23+
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
24+
*/
25+
export type APIPrimaryEntryPointCommandGuildInteraction =
26+
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;

payloads/v10/_interactions/applicationCommands.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ import type {
1313
APIContextMenuInteraction,
1414
APIContextMenuInteractionData,
1515
} from './_applicationCommands/contextMenu';
16+
import type {
17+
APIPrimaryEntryPointCommandDMInteraction,
18+
APIPrimaryEntryPointCommandGuildInteraction,
19+
APIPrimaryEntryPointCommandInteraction,
20+
APIPrimaryEntryPointCommandInteractionData,
21+
} from './_applicationCommands/entryPoint';
1622
import type { APIBaseInteraction } from './base';
1723
import type { InteractionType } from './responses';
1824

1925
export * from './_applicationCommands/chatInput';
2026
export * from './_applicationCommands/contextMenu';
2127
export * from './_applicationCommands/permissions';
28+
export * from './_applicationCommands/entryPoint';
2229

2330
/**
2431
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
185192
*/
186193
export type APIApplicationCommandInteractionData =
187194
| APIChatInputApplicationCommandInteractionData
188-
| APIContextMenuInteractionData;
195+
| APIContextMenuInteractionData
196+
| APIPrimaryEntryPointCommandInteractionData;
189197

190198
/**
191199
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
202210
/**
203211
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
204212
*/
205-
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
213+
export type APIApplicationCommandInteraction =
214+
| APIChatInputApplicationCommandInteraction
215+
| APIContextMenuInteraction
216+
| APIPrimaryEntryPointCommandInteraction;
206217

207218
/**
208219
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
209220
*/
210221
export type APIApplicationCommandDMInteraction =
211222
| APIChatInputApplicationCommandDMInteraction
212-
| APIContextMenuDMInteraction;
223+
| APIContextMenuDMInteraction
224+
| APIPrimaryEntryPointCommandDMInteraction;
213225

214226
/**
215227
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
216228
*/
217229
export type APIApplicationCommandGuildInteraction =
218230
| APIChatInputApplicationCommandGuildInteraction
219-
| APIContextMenuGuildInteraction;
231+
| APIContextMenuGuildInteraction
232+
| APIPrimaryEntryPointCommandGuildInteraction;

0 commit comments

Comments
 (0)