-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Interactions): context menu items (#166)
- Loading branch information
Showing
44 changed files
with
1,602 additions
and
722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
deno/payloads/v8/_interactions/_applicationCommands/contextMenu.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import type { APIUser } from '../../user.ts'; | ||
import type { Snowflake } from '../../../../globals.ts'; | ||
import type { APIMessage } from '../../channel.ts'; | ||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts'; | ||
import type { | ||
APIApplicationCommandInteractionWrapper, | ||
APIInteractionDataResolvedGuildMember, | ||
ApplicationCommandType, | ||
} from '../applicationCommands.ts'; | ||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts'; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure | ||
*/ | ||
export interface APIUserApplicationCommandInteractionData | ||
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.User> { | ||
target_id: Snowflake; | ||
resolved: APIUserApplicationCommandInteractionDataResolved; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure | ||
*/ | ||
export interface APIUserApplicationCommandInteractionDataResolved { | ||
users: Record<Snowflake, APIUser>; | ||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure | ||
*/ | ||
export interface APIMessageApplicationCommandInteractionData | ||
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.Message> { | ||
target_id: Snowflake; | ||
resolved: APIMessageApplicationCommandInteractionDataResolved; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure | ||
*/ | ||
export interface APIMessageApplicationCommandInteractionDataResolved { | ||
messages: Record<Snowflake, APIMessage>; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure | ||
*/ | ||
export type APIContextMenuInteractionData = | ||
| APIUserApplicationCommandInteractionData | ||
| APIMessageApplicationCommandInteractionData; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIUserApplicationCommandInteraction = | ||
APIApplicationCommandInteractionWrapper<APIUserApplicationCommandInteractionData>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIUserApplicationCommandDMInteraction = APIDMInteractionWrapper<APIUserApplicationCommandInteraction>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIUserApplicationCommandGuildInteraction = | ||
APIGuildInteractionWrapper<APIUserApplicationCommandInteraction>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIMessageApplicationCommandInteraction = | ||
APIApplicationCommandInteractionWrapper<APIMessageApplicationCommandInteractionData>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIMessageApplicationCommandDMInteraction = | ||
APIDMInteractionWrapper<APIMessageApplicationCommandInteraction>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIMessageApplicationCommandGuildInteraction = | ||
APIGuildInteractionWrapper<APIMessageApplicationCommandInteraction>; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIContextMenuDMInteraction = | ||
| APIUserApplicationCommandDMInteraction | ||
| APIMessageApplicationCommandDMInteraction; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object | ||
*/ | ||
export type APIContextMenuGuildInteraction = | ||
| APIUserApplicationCommandGuildInteraction | ||
| APIMessageApplicationCommandGuildInteraction; |
8 changes: 8 additions & 0 deletions
8
deno/payloads/v8/_interactions/_applicationCommands/internals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { Snowflake } from '../../../../globals.ts'; | ||
import type { ApplicationCommandType } from '../applicationCommands.ts'; | ||
|
||
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> { | ||
id: Snowflake; | ||
type: Type; | ||
name: string; | ||
} |
49 changes: 49 additions & 0 deletions
49
deno/payloads/v8/_interactions/_applicationCommands/permissions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { Snowflake } from '../../../../globals.ts'; | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure | ||
*/ | ||
export interface APIGuildApplicationCommandPermissions { | ||
/** | ||
* The id of the command | ||
*/ | ||
id: Snowflake; | ||
/** | ||
* The id of the application the command belongs to | ||
*/ | ||
application_id: Snowflake; | ||
/** | ||
* The id of the guild | ||
*/ | ||
guild_id: Snowflake; | ||
/** | ||
* The permissions for the command in the guild | ||
*/ | ||
permissions: APIApplicationCommandPermission[]; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure | ||
*/ | ||
export interface APIApplicationCommandPermission { | ||
/** | ||
* The id of the role or user | ||
*/ | ||
id: Snowflake; | ||
/** | ||
* Role or user | ||
*/ | ||
type: ApplicationCommandPermissionType; | ||
/** | ||
* `true` to allow, `false`, to disallow | ||
*/ | ||
permission: boolean; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type | ||
*/ | ||
export enum ApplicationCommandPermissionType { | ||
Role = 1, | ||
User, | ||
} |
Oops, something went wrong.