Compare commits

...

13 Commits

Author SHA1 Message Date
Vlad Frangu
21e1148f2d chore(release): 0.23.0 🎉 (#194) 2021-09-07 17:41:34 +03:00
Vlad Frangu
8b49887c7f feat(JSONErrorCodes): add 160002 (#190)
ref: https://github.com/discord/discord-api-docs/pull/3738
2021-09-07 12:57:06 +03:00
Vlad Frangu
d590caf359 chore(Gateway): remove APPLICATION_COMMAND_* events (#191)
BREAKING CHANGE: The three Application Command events have been removed
2021-09-07 12:56:43 +03:00
Vlad Frangu
ecbed18042 feat(APIApplicationCommand): add version field (#193)
ref: https://github.com/discord/discord-api-docs/pull/3524
2021-09-07 12:56:34 +03:00
Vlad Frangu
e628f0f6f0 fix(Embed): corrent certain optional types as being required (#192)
BREAKING CHANGE:
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
2021-09-07 12:56:14 +03:00
Advaith
0024823d05 feat(MessageType): add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand (#180) 2021-09-05 19:41:15 +03:00
Jiralite
64937e2311 fix(AuditLog): correct nickname type (#189)
* fix(auditLog): Correct nickname type

* something something deno

* chore: Apply fix to v8
2021-08-30 12:31:56 +02:00
Jiralite
f2e22869d0 chore: Update invite link (#188) 2021-08-25 07:41:30 +02:00
Advaith
b6babf2ee2 feat(threads): add invitable (#185) 2021-08-22 11:32:31 +02:00
Advaith
f2b58acbf8 chore: add missing json error codes (#184) 2021-08-22 02:33:04 +02:00
Advaith
b07b9030c1 feat(APIUser): add banner and accent_color (#183)
* feat(APIUser): add `banner` and `accent_color`

* chore: v8
2021-08-22 02:31:02 +02:00
Advaith
fdc1c1a5b4 feat(Interactions): context menu items (#166) 2021-08-14 19:58:34 +02:00
Arcoz
8fcd0f2222 fix: import causing error 404 on deno (#178) 2021-08-07 09:53:10 +02:00
74 changed files with 1819 additions and 975 deletions

View File

@@ -55,7 +55,7 @@ a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at https://discord.gg/bRCvFy9. All
reported by contacting the project team at https://discord.gg/djs. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@@ -1,6 +1,6 @@
# discord-api-types Contributing Guide
**The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the [Discord server](https://discord.gg/bRCvFy9) instead of opening an issue, or on [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions) you will get redirected there anyway.**
**The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the [Discord server](https://discord.gg/djs) instead of opening an issue, or on [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions) you will get redirected there anyway.**
- [Code of Conduct](https://github.com/discordjs/discord-api-types/blob/main/.github/CODE_OF_CONDUCT.md)
- [Pull Request Guidelines](#pull-request-guidelines)

View File

@@ -6,7 +6,7 @@ labels: 'bug'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/bRCvFy9 -->
<!-- Use Discord for questions: https://discord.gg/djs -->
**Please describe the problem you are having in as much detail as possible:**

View File

@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord server
url: https://discord.gg/bRCvFy9
url: https://discord.gg/djs
about: Please visit our Discord server for questions and support requests.

View File

@@ -6,7 +6,7 @@ labels: 'discussion'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/bRCvFy9 -->
<!-- Use Discord for questions: https://discord.gg/djs -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Eg. I'm always frustrated when [...]

2
.github/SUPPORT.md vendored
View File

@@ -3,6 +3,6 @@
We only use this issue tracker for bug reports and feature request. We are not able to provide general support or answer questions in the form of GitHub issues.
For general questions about discord-api-types installation and use please ask in [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions),
or in the dedicated support channels in our Discord server: https://discord.gg/bRCvFy9
or in the dedicated support channels in our Discord server: https://discord.gg/djs
Any issues that don't directly involve a bug or a feature request will likely be closed and redirected.

View File

@@ -1,3 +1,32 @@
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes

View File

@@ -1,3 +1,32 @@
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes

View File

@@ -5,7 +5,6 @@
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
@@ -190,9 +189,6 @@ export enum GatewayIntentBits {
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -298,55 +294,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/

View File

@@ -5,7 +5,6 @@
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
@@ -193,9 +192,6 @@ export enum GatewayIntentBits {
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -308,55 +304,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/

View File

@@ -1,45 +1,13 @@
import type { APIRole, APIUser } from '../mod.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { InteractionType } from './responses.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
@@ -55,7 +23,7 @@ interface APIApplicationCommandOptionBase {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
@@ -87,7 +55,7 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
@@ -103,7 +71,7 @@ export enum ApplicationCommandOptionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
@@ -111,36 +79,7 @@ export interface APIApplicationCommandOptionChoice {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
@@ -215,69 +154,39 @@ interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D =
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-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[];
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-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;
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
// INTERACTIONS
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput.ts';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from '../../v8.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -2,7 +2,7 @@ import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
@@ -11,7 +11,7 @@ export enum InteractionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
@@ -44,7 +44,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
@@ -70,7 +70,7 @@ export enum InteractionResponseType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,

View File

@@ -544,7 +544,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed

View File

@@ -382,8 +382,9 @@ export enum MessageType {
GuildDiscoveryGracePeriodInitialWarning,
GuildDiscoveryGracePeriodFinalWarning,
Reply = 19,
ApplicationCommand,
ChatInputCommand,
GuildInviteReminder = 22,
ContextMenuCommand,
}
/**
@@ -659,7 +660,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -699,7 +700,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -737,7 +738,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/

View File

@@ -8,16 +8,25 @@ import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/slashCommands.ts';
} from './_interactions/applicationCommands.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';
export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

View File

@@ -94,15 +94,15 @@ export enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,7 +43,7 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
UseExternalStickers: 1n << 37n,
} as const;

View File

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/

View File

@@ -1,45 +1,13 @@
import type { APIRole, APIUser } from '../mod.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { InteractionType } from './responses.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
@@ -55,7 +23,7 @@ interface APIApplicationCommandOptionBase {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
@@ -87,7 +55,7 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
@@ -103,7 +71,7 @@ export enum ApplicationCommandOptionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
@@ -111,36 +79,7 @@ export interface APIApplicationCommandOptionChoice {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
@@ -215,69 +154,39 @@ interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D =
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-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[];
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-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;
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
// INTERACTIONS
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput.ts';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from '../../v9.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -2,7 +2,7 @@ import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
@@ -11,7 +11,7 @@ export enum InteractionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
@@ -44,7 +44,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
@@ -70,7 +70,7 @@ export enum InteractionResponseType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,

View File

@@ -560,7 +560,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed

View File

@@ -428,9 +428,10 @@ export enum MessageType {
GuildDiscoveryGracePeriodFinalWarning,
ThreadCreated,
Reply,
ApplicationCommand,
ChatInputCommand,
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
}
/**
@@ -608,6 +609,10 @@ export interface APIThreadMetadata {
* Whether the thread is locked; when a thread is locked, only users with `MANAGE_THREADS` can unarchive it
*/
locked?: boolean;
/**
* Whether non-moderators can add other non-moderators to the thread; only available on private threads
*/
invitable?: boolean;
}
export enum ThreadAutoArchiveDuration {
@@ -784,7 +789,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -824,7 +829,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -862,7 +867,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/

View File

@@ -8,16 +8,25 @@ import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/slashCommands.ts';
} from './_interactions/applicationCommands.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';
export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

View File

@@ -94,15 +94,15 @@ export enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,7 +43,7 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,

View File

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/

View File

@@ -36,6 +36,9 @@ export enum RESTJSONErrorCodes {
UnknownGiftCode = 10038,
UnknownStream = 10049,
UnknownPremiumServerSubscribeCooldown,
UnknownGuildTemplate = 10057,
UnknownDiscoverableServerCategory = 10059,
@@ -48,6 +51,8 @@ export enum RESTJSONErrorCodes {
UnknownStageInstance,
UnknownGuildMemberVerificationForm,
UnknownGuildWelcomeScreen,
UnknownGuildScheduledEvent,
UnknownGuildScheduledEventUser,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
@@ -98,6 +103,7 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfBanFetchesHasBeenReached = 30037,
MaximumNumberOfStickersReached = 30039,
MaximumNumberOfPruneRequestsHasBeenReached,
Unauthorized = 40001,
VerifyYourAccount,
@@ -135,6 +141,7 @@ export enum RESTJSONErrorCodes {
CannotExecuteActionOnThisChannelType = 50024,
InvalidOAuth2AccessToken,
MissingRequiredOAuth2Scope,
InvalidWebhookToken = 50027,
InvalidRole,
@@ -149,7 +156,9 @@ export enum RESTJSONErrorCodes {
FileUploadedExceedsMaximumSize = 50045,
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50070,
CannotSelfRedeemThisGift = 50054,
PaymentSourceRequiredToRedeemGift = 50070,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
@@ -159,6 +168,10 @@ export enum RESTJSONErrorCodes {
InvalidThreadNotificationSettings,
ParameterEarlierThanCreation,
ServerNotAvailableInYourLocation = 50095,
ServerNeedsMonetizationEnabledToPerformThisAction = 50097,
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
@@ -169,6 +182,8 @@ export enum RESTJSONErrorCodes {
TheStageIsAlreadyOpen = 150006,
CannotReplyWithoutPermissionToReadMessageHistory = 160002,
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,

View File

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v8/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,92 +16,114 @@ import type {
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
@@ -121,37 +144,37 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
@@ -172,59 +195,59 @@ export type RESTPostAPIInteractionFollowupFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +255,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

View File

@@ -130,6 +130,12 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: text, news
*/
default_auto_archive_duration?: ThreadAutoArchiveDuration;
/**
* Whether non-moderators can add other non-moderators to the thread
*
* Channel types: privateThread
*/
invitable?: boolean;
}
/**
@@ -603,6 +609,10 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}
/**

View File

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v9/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,92 +16,114 @@ import type {
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
@@ -121,37 +144,37 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
@@ -172,59 +195,59 @@ export type RESTPostAPIInteractionFollowupFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +255,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

View File

@@ -5,7 +5,6 @@
import type { Snowflake } from '../globals';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
@@ -190,9 +189,6 @@ export const enum GatewayIntentBits {
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export const enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -298,55 +294,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/

View File

@@ -5,7 +5,6 @@
import type { Snowflake } from '../globals';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
@@ -193,9 +192,6 @@ export const enum GatewayIntentBits {
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export const enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -308,55 +304,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{
"name": "discord-api-types",
"version": "0.22.0",
"version": "0.23.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.22.0",
"version": "0.23.0",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.14.6",

View File

@@ -1,6 +1,6 @@
{
"name": "discord-api-types",
"version": "0.22.0",
"version": "0.23.0",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./v9.js",
"module": "./v9.mjs",

View File

@@ -1,45 +1,13 @@
import type { APIRole, APIUser } from '../index';
import type { Permissions, Snowflake } from '../../../globals';
import type { APIPartialChannel } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
import type { InteractionType } from './responses';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
import type { APIRole, APIUser } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
interface APIApplicationCommandOptionBase {
type:
@@ -55,7 +23,7 @@ interface APIApplicationCommandOptionBase {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
@@ -87,7 +55,7 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
@@ -103,7 +71,7 @@ export const enum ApplicationCommandOptionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
@@ -111,36 +79,7 @@ export interface APIApplicationCommandOptionChoice {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
@@ -215,69 +154,39 @@ interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D =
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-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[];
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-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;
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export const enum ApplicationCommandPermissionType {
Role = 1,
User,
}
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
// INTERACTIONS
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

@@ -0,0 +1,104 @@
import type { APIUser } from '../../user';
import type { Snowflake } from '../../../../globals';
import type { APIMessage } from '../../channel';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
/**
* 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;

View File

@@ -0,0 +1,8 @@
import type { Snowflake } from '../../../../globals';
import type { ApplicationCommandType } from '../applicationCommands';
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> {
id: Snowflake;
type: Type;
name: string;
}

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals';
/**
* 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 const enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { APIPartialChannel } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction } from './base';
import type { InteractionType } from './responses';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu';
export * from './_applicationCommands/chatInput';
export * from './_applicationCommands/contextMenu';
export * from './_applicationCommands/permissions';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export const enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { InteractionType } from '../../v8';
import type { InteractionType } from './responses';
import type { APIMessage } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIUser } from '../user';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -2,7 +2,7 @@ import type { MessageFlags } from '../index';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export const enum InteractionType {
Ping = 1,
@@ -11,7 +11,7 @@ export const enum InteractionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
@@ -44,7 +44,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export const enum InteractionResponseType {
/**
@@ -70,7 +70,7 @@ export const enum InteractionResponseType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,

View File

@@ -544,7 +544,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed

View File

@@ -382,8 +382,9 @@ export const enum MessageType {
GuildDiscoveryGracePeriodInitialWarning,
GuildDiscoveryGracePeriodFinalWarning,
Reply = 19,
ApplicationCommand,
ChatInputCommand,
GuildInviteReminder = 22,
ContextMenuCommand,
}
/**
@@ -659,7 +660,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -699,7 +700,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -737,7 +738,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/

View File

@@ -8,16 +8,25 @@ import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/slashCommands';
} from './_interactions/applicationCommands';
export * from './_interactions/base';
export * from './_interactions/messageComponents';
export * from './_interactions/ping';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';
export * from './_interactions/applicationCommands';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

View File

@@ -94,15 +94,15 @@ export const enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,7 +43,7 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
UseExternalStickers: 1n << 37n,
} as const;

View File

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/

View File

@@ -1,45 +1,13 @@
import type { APIRole, APIUser } from '../index';
import type { Permissions, Snowflake } from '../../../globals';
import type { APIPartialChannel } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
import type { InteractionType } from './responses';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
import type { APIRole, APIUser } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
interface APIApplicationCommandOptionBase {
type:
@@ -55,7 +23,7 @@ interface APIApplicationCommandOptionBase {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
@@ -87,7 +55,7 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
@@ -103,7 +71,7 @@ export const enum ApplicationCommandOptionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
@@ -111,36 +79,7 @@ export interface APIApplicationCommandOptionChoice {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
@@ -215,69 +154,39 @@ interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D =
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-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[];
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-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;
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export const enum ApplicationCommandPermissionType {
Role = 1,
User,
}
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
// INTERACTIONS
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

@@ -0,0 +1,104 @@
import type { APIUser } from '../../user';
import type { Snowflake } from '../../../../globals';
import type { APIMessage } from '../../channel';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
/**
* 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;

View File

@@ -0,0 +1,8 @@
import type { Snowflake } from '../../../../globals';
import type { ApplicationCommandType } from '../applicationCommands';
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> {
id: Snowflake;
type: Type;
name: string;
}

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals';
/**
* 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 const enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { APIPartialChannel } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction } from './base';
import type { InteractionType } from './responses';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu';
export * from './_applicationCommands/chatInput';
export * from './_applicationCommands/contextMenu';
export * from './_applicationCommands/permissions';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export const enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { InteractionType } from '../../v9';
import type { InteractionType } from './responses';
import type { APIMessage } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIUser } from '../user';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -2,7 +2,7 @@ import type { MessageFlags } from '../index';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export const enum InteractionType {
Ping = 1,
@@ -11,7 +11,7 @@ export const enum InteractionType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
@@ -44,7 +44,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export const enum InteractionResponseType {
/**
@@ -70,7 +70,7 @@ export const enum InteractionResponseType {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,

View File

@@ -560,7 +560,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed

View File

@@ -428,9 +428,10 @@ export const enum MessageType {
GuildDiscoveryGracePeriodFinalWarning,
ThreadCreated,
Reply,
ApplicationCommand,
ChatInputCommand,
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
}
/**
@@ -608,6 +609,10 @@ export interface APIThreadMetadata {
* Whether the thread is locked; when a thread is locked, only users with `MANAGE_THREADS` can unarchive it
*/
locked?: boolean;
/**
* Whether non-moderators can add other non-moderators to the thread; only available on private threads
*/
invitable?: boolean;
}
export const enum ThreadAutoArchiveDuration {
@@ -784,7 +789,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -824,7 +829,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -862,7 +867,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/

View File

@@ -8,16 +8,25 @@ import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/slashCommands';
} from './_interactions/applicationCommands';
export * from './_interactions/base';
export * from './_interactions/messageComponents';
export * from './_interactions/ping';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';
export * from './_interactions/applicationCommands';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

View File

@@ -94,15 +94,15 @@ export const enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,7 +43,7 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,

View File

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/

View File

@@ -36,6 +36,9 @@ export const enum RESTJSONErrorCodes {
UnknownGiftCode = 10038,
UnknownStream = 10049,
UnknownPremiumServerSubscribeCooldown,
UnknownGuildTemplate = 10057,
UnknownDiscoverableServerCategory = 10059,
@@ -48,6 +51,8 @@ export const enum RESTJSONErrorCodes {
UnknownStageInstance,
UnknownGuildMemberVerificationForm,
UnknownGuildWelcomeScreen,
UnknownGuildScheduledEvent,
UnknownGuildScheduledEventUser,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
@@ -98,6 +103,7 @@ export const enum RESTJSONErrorCodes {
MaximumNumberOfBanFetchesHasBeenReached = 30037,
MaximumNumberOfStickersReached = 30039,
MaximumNumberOfPruneRequestsHasBeenReached,
Unauthorized = 40001,
VerifyYourAccount,
@@ -135,6 +141,7 @@ export const enum RESTJSONErrorCodes {
CannotExecuteActionOnThisChannelType = 50024,
InvalidOAuth2AccessToken,
MissingRequiredOAuth2Scope,
InvalidWebhookToken = 50027,
InvalidRole,
@@ -149,7 +156,9 @@ export const enum RESTJSONErrorCodes {
FileUploadedExceedsMaximumSize = 50045,
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50070,
CannotSelfRedeemThisGift = 50054,
PaymentSourceRequiredToRedeemGift = 50070,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
@@ -159,6 +168,10 @@ export const enum RESTJSONErrorCodes {
InvalidThreadNotificationSettings,
ParameterEarlierThanCreation,
ServerNotAvailableInYourLocation = 50095,
ServerNeedsMonetizationEnabledToPerformThisAction = 50097,
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
@@ -169,6 +182,8 @@ export const enum RESTJSONErrorCodes {
TheStageIsAlreadyOpen = 150006,
CannotReplyWithoutPermissionToReadMessageHistory = 160002,
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,

View File

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v8/index';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,92 +16,114 @@ import type {
} from './webhook';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
@@ -121,37 +144,37 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
@@ -172,59 +195,59 @@ export type RESTPostAPIInteractionFollowupFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +255,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

View File

@@ -130,6 +130,12 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: text, news
*/
default_auto_archive_duration?: ThreadAutoArchiveDuration;
/**
* Whether non-moderators can add other non-moderators to the thread
*
* Channel types: privateThread
*/
invitable?: boolean;
}
/**
@@ -603,6 +609,10 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}
/**

View File

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v9/index';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,92 +16,114 @@ import type {
} from './webhook';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
@@ -121,37 +144,37 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
@@ -172,59 +195,59 @@ export type RESTPostAPIInteractionFollowupFormDataBody =
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +255,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];