mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-22 11:20:10 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ffb2d3586 | ||
|
|
f62f2506b0 | ||
|
|
2876125975 | ||
|
|
143b003fbe | ||
|
|
0f118d382f | ||
|
|
2dc3fd0a15 | ||
|
|
d452f6346b | ||
|
|
32f5a7b981 | ||
|
|
f4d3f4d5b1 | ||
|
|
5c7e58284e | ||
|
|
afd3b55c08 | ||
|
|
4fbe1180fc | ||
|
|
2708cb9dca | ||
|
|
a59998ad1c | ||
|
|
b08f2e34db | ||
|
|
a1100a1910 | ||
|
|
815c68fe46 | ||
|
|
04b3a7f066 | ||
|
|
b7b855b200 | ||
|
|
4e362d5260 | ||
|
|
48f0f562ba | ||
|
|
817884184b | ||
|
|
73d15ddcbb | ||
|
|
f69b586d01 | ||
|
|
1a6884423c | ||
|
|
0098889499 | ||
|
|
bd8765d666 | ||
|
|
96b4bc504d | ||
|
|
35b17dcbf8 | ||
|
|
956f289e88 | ||
|
|
ef8241fe88 | ||
|
|
248484e556 | ||
|
|
1fe707c00e | ||
|
|
5bb50ae7ea |
68
CHANGELOG.md
68
CHANGELOG.md
@@ -1,3 +1,71 @@
|
||||
## [0.37.12](https://github.com/discordjs/discord-api-types/compare/0.37.11...0.37.12) (2022-10-06)
|
||||
|
||||
## [0.37.11](https://github.com/discordjs/discord-api-types/compare/0.37.10...0.37.11) (2022-09-26)
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildForumChannel:** add `default_sort_order` ([#589](https://github.com/discordjs/discord-api-types/issues/589)) ([143b003](https://github.com/discordjs/discord-api-types/commit/143b003fbe5a86eda225e9da1d0914d6e48cddfd))
|
||||
- **APIGuildForumChannel:** update and add missing features ([#575](https://github.com/discordjs/discord-api-types/issues/575)) ([0f118d3](https://github.com/discordjs/discord-api-types/commit/0f118d382f94151b1c9be42620520c91b20a05f6))
|
||||
|
||||
## [0.37.10](https://github.com/discordjs/discord-api-types/compare/0.37.9...0.37.10) (2022-09-15)
|
||||
|
||||
### Features
|
||||
|
||||
- add `RESTRateLimit` ([#585](https://github.com/discordjs/discord-api-types/issues/585)) ([f4d3f4d](https://github.com/discordjs/discord-api-types/commit/f4d3f4d5b1c1b6e42c2a8f8184f43d67b586c8c1))
|
||||
- **APIConnection:** add `two_way_link` ([#546](https://github.com/discordjs/discord-api-types/issues/546)) ([d452f63](https://github.com/discordjs/discord-api-types/commit/d452f6346bd4953a8d777f3818797c4285b1b842))
|
||||
- **APIGuild:** document afk timeout values ([#570](https://github.com/discordjs/discord-api-types/issues/570)) ([32f5a7b](https://github.com/discordjs/discord-api-types/commit/32f5a7b9814b69da7fc3772ec1f0307d39cda087))
|
||||
|
||||
## [0.37.9](https://github.com/discordjs/discord-api-types/compare/0.37.8...0.37.9) (2022-09-12)
|
||||
|
||||
### Features
|
||||
|
||||
- **ConnectionService:** add new connections ([#548](https://github.com/discordjs/discord-api-types/issues/548)) ([afd3b55](https://github.com/discordjs/discord-api-types/commit/afd3b55c08b0cf75cc4f5a06d3574b6cf532cb6c))
|
||||
|
||||
## [0.37.8](https://github.com/discordjs/discord-api-types/compare/0.37.7...0.37.8) (2022-09-08)
|
||||
|
||||
### Features
|
||||
|
||||
- **GuildFeature:** add `InvitesDisabled` ([#549](https://github.com/discordjs/discord-api-types/issues/549)) ([2708cb9](https://github.com/discordjs/discord-api-types/commit/2708cb9dcaa07d19ca71e9ca211e78939b9d1ff4))
|
||||
|
||||
## [0.37.7](https://github.com/discordjs/discord-api-types/compare/0.37.6...0.37.7) (2022-09-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ChannelType:** bring back old names ([b08f2e3](https://github.com/discordjs/discord-api-types/commit/b08f2e34dbe9afccca6f565db6c7b27a21453d85))
|
||||
|
||||
## [0.37.6](https://github.com/discordjs/discord-api-types/compare/0.37.5...0.37.6) (2022-09-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIModalSubmission:** `components` is not optional ([#574](https://github.com/discordjs/discord-api-types/issues/574)) ([f69b586](https://github.com/discordjs/discord-api-types/commit/f69b586d0148afd017e6da70ab8d745b6ba04ba4))
|
||||
- **GuildChannelType:** add missing `GuildCategory` type ([#579](https://github.com/discordjs/discord-api-types/issues/579)) ([815c68f](https://github.com/discordjs/discord-api-types/commit/815c68fe46034029200a8e2903748a3d2e6af7b9))
|
||||
- **RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody:** `channel_id` is optional ([#547](https://github.com/discordjs/discord-api-types/issues/547)) ([b7b855b](https://github.com/discordjs/discord-api-types/commit/b7b855b2005bb3989810850d6e00bec443a15c92))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildIntegration:** add `scopes` ([#563](https://github.com/discordjs/discord-api-types/issues/563)) ([73d15dd](https://github.com/discordjs/discord-api-types/commit/73d15ddcbbc676efac876602a3cd726bfe4c378a))
|
||||
- **ApplicationFlags:** add `ApplicationCommandBadge` ([#537](https://github.com/discordjs/discord-api-types/issues/537)) ([48f0f56](https://github.com/discordjs/discord-api-types/commit/48f0f562bab10d2a1e331474fb963af8631b788b))
|
||||
- **RESTPutAPIGuildBanJSONBody:** add `delete_message_seconds` ([#534](https://github.com/discordjs/discord-api-types/issues/534)) ([4e362d5](https://github.com/discordjs/discord-api-types/commit/4e362d52608e99d466b43cd37ec6b6bb1222b660))
|
||||
|
||||
## [0.37.5](https://github.com/discordjs/discord-api-types/compare/0.37.4...0.37.5) (2022-08-25)
|
||||
|
||||
### Features
|
||||
|
||||
- **FormattingPatterns:** add `ApplicationCommand` ([#525](https://github.com/discordjs/discord-api-types/issues/525)) ([0098889](https://github.com/discordjs/discord-api-types/commit/00988894995f7ac5e8ddc34125704a230329137c))
|
||||
|
||||
## [0.37.4](https://github.com/discordjs/discord-api-types/compare/0.37.3...0.37.4) (2022-08-22)
|
||||
|
||||
### Features
|
||||
|
||||
- add common JSON error types ([#568](https://github.com/discordjs/discord-api-types/issues/568)) ([956f289](https://github.com/discordjs/discord-api-types/commit/956f289e885763a620cb67a36e7e42683b5c08bf))
|
||||
- **ApplicationCommand:** export base chat input types ([#569](https://github.com/discordjs/discord-api-types/issues/569)) ([248484e](https://github.com/discordjs/discord-api-types/commit/248484e55613e2da3f1d659395e1f4c010cb51b5))
|
||||
|
||||
## [0.37.3](https://github.com/discordjs/discord-api-types/compare/0.37.2...0.37.3) (2022-08-18)
|
||||
|
||||
### Features
|
||||
|
||||
- **RESTJSONErrorCodes:** add 240000 ([#565](https://github.com/discordjs/discord-api-types/issues/565)) ([5bb50ae](https://github.com/discordjs/discord-api-types/commit/5bb50ae7ea6859845c9d9996f02ac42c61413df0))
|
||||
|
||||
## [0.37.2](https://github.com/discordjs/discord-api-types/compare/0.37.1...0.37.2) (2022-08-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,3 +1,71 @@
|
||||
## [0.37.12](https://github.com/discordjs/discord-api-types/compare/0.37.11...0.37.12) (2022-10-06)
|
||||
|
||||
## [0.37.11](https://github.com/discordjs/discord-api-types/compare/0.37.10...0.37.11) (2022-09-26)
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildForumChannel:** add `default_sort_order` ([#589](https://github.com/discordjs/discord-api-types/issues/589)) ([143b003](https://github.com/discordjs/discord-api-types/commit/143b003fbe5a86eda225e9da1d0914d6e48cddfd))
|
||||
- **APIGuildForumChannel:** update and add missing features ([#575](https://github.com/discordjs/discord-api-types/issues/575)) ([0f118d3](https://github.com/discordjs/discord-api-types/commit/0f118d382f94151b1c9be42620520c91b20a05f6))
|
||||
|
||||
## [0.37.10](https://github.com/discordjs/discord-api-types/compare/0.37.9...0.37.10) (2022-09-15)
|
||||
|
||||
### Features
|
||||
|
||||
- add `RESTRateLimit` ([#585](https://github.com/discordjs/discord-api-types/issues/585)) ([f4d3f4d](https://github.com/discordjs/discord-api-types/commit/f4d3f4d5b1c1b6e42c2a8f8184f43d67b586c8c1))
|
||||
- **APIConnection:** add `two_way_link` ([#546](https://github.com/discordjs/discord-api-types/issues/546)) ([d452f63](https://github.com/discordjs/discord-api-types/commit/d452f6346bd4953a8d777f3818797c4285b1b842))
|
||||
- **APIGuild:** document afk timeout values ([#570](https://github.com/discordjs/discord-api-types/issues/570)) ([32f5a7b](https://github.com/discordjs/discord-api-types/commit/32f5a7b9814b69da7fc3772ec1f0307d39cda087))
|
||||
|
||||
## [0.37.9](https://github.com/discordjs/discord-api-types/compare/0.37.8...0.37.9) (2022-09-12)
|
||||
|
||||
### Features
|
||||
|
||||
- **ConnectionService:** add new connections ([#548](https://github.com/discordjs/discord-api-types/issues/548)) ([afd3b55](https://github.com/discordjs/discord-api-types/commit/afd3b55c08b0cf75cc4f5a06d3574b6cf532cb6c))
|
||||
|
||||
## [0.37.8](https://github.com/discordjs/discord-api-types/compare/0.37.7...0.37.8) (2022-09-08)
|
||||
|
||||
### Features
|
||||
|
||||
- **GuildFeature:** add `InvitesDisabled` ([#549](https://github.com/discordjs/discord-api-types/issues/549)) ([2708cb9](https://github.com/discordjs/discord-api-types/commit/2708cb9dcaa07d19ca71e9ca211e78939b9d1ff4))
|
||||
|
||||
## [0.37.7](https://github.com/discordjs/discord-api-types/compare/0.37.6...0.37.7) (2022-09-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ChannelType:** bring back old names ([b08f2e3](https://github.com/discordjs/discord-api-types/commit/b08f2e34dbe9afccca6f565db6c7b27a21453d85))
|
||||
|
||||
## [0.37.6](https://github.com/discordjs/discord-api-types/compare/0.37.5...0.37.6) (2022-09-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIModalSubmission:** `components` is not optional ([#574](https://github.com/discordjs/discord-api-types/issues/574)) ([f69b586](https://github.com/discordjs/discord-api-types/commit/f69b586d0148afd017e6da70ab8d745b6ba04ba4))
|
||||
- **GuildChannelType:** add missing `GuildCategory` type ([#579](https://github.com/discordjs/discord-api-types/issues/579)) ([815c68f](https://github.com/discordjs/discord-api-types/commit/815c68fe46034029200a8e2903748a3d2e6af7b9))
|
||||
- **RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody:** `channel_id` is optional ([#547](https://github.com/discordjs/discord-api-types/issues/547)) ([b7b855b](https://github.com/discordjs/discord-api-types/commit/b7b855b2005bb3989810850d6e00bec443a15c92))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildIntegration:** add `scopes` ([#563](https://github.com/discordjs/discord-api-types/issues/563)) ([73d15dd](https://github.com/discordjs/discord-api-types/commit/73d15ddcbbc676efac876602a3cd726bfe4c378a))
|
||||
- **ApplicationFlags:** add `ApplicationCommandBadge` ([#537](https://github.com/discordjs/discord-api-types/issues/537)) ([48f0f56](https://github.com/discordjs/discord-api-types/commit/48f0f562bab10d2a1e331474fb963af8631b788b))
|
||||
- **RESTPutAPIGuildBanJSONBody:** add `delete_message_seconds` ([#534](https://github.com/discordjs/discord-api-types/issues/534)) ([4e362d5](https://github.com/discordjs/discord-api-types/commit/4e362d52608e99d466b43cd37ec6b6bb1222b660))
|
||||
|
||||
## [0.37.5](https://github.com/discordjs/discord-api-types/compare/0.37.4...0.37.5) (2022-08-25)
|
||||
|
||||
### Features
|
||||
|
||||
- **FormattingPatterns:** add `ApplicationCommand` ([#525](https://github.com/discordjs/discord-api-types/issues/525)) ([0098889](https://github.com/discordjs/discord-api-types/commit/00988894995f7ac5e8ddc34125704a230329137c))
|
||||
|
||||
## [0.37.4](https://github.com/discordjs/discord-api-types/compare/0.37.3...0.37.4) (2022-08-22)
|
||||
|
||||
### Features
|
||||
|
||||
- add common JSON error types ([#568](https://github.com/discordjs/discord-api-types/issues/568)) ([956f289](https://github.com/discordjs/discord-api-types/commit/956f289e885763a620cb67a36e7e42683b5c08bf))
|
||||
- **ApplicationCommand:** export base chat input types ([#569](https://github.com/discordjs/discord-api-types/issues/569)) ([248484e](https://github.com/discordjs/discord-api-types/commit/248484e55613e2da3f1d659395e1f4c010cb51b5))
|
||||
|
||||
## [0.37.3](https://github.com/discordjs/discord-api-types/compare/0.37.2...0.37.3) (2022-08-18)
|
||||
|
||||
### Features
|
||||
|
||||
- **RESTJSONErrorCodes:** add 240000 ([#565](https://github.com/discordjs/discord-api-types/issues/565)) ([5bb50ae](https://github.com/discordjs/discord-api-types/commit/5bb50ae7ea6859845c9d9996f02ac42c61413df0))
|
||||
|
||||
## [0.37.2](https://github.com/discordjs/discord-api-types/compare/0.37.1...0.37.2) (2022-08-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -45,6 +45,13 @@ export const FormattingPatterns = {
|
||||
* The `id` group property is present on the `exec` result of this expression
|
||||
*/
|
||||
Role: /<@&(?<id>\d{17,20})>/,
|
||||
/**
|
||||
* Regular expression for matching a application command mention
|
||||
*
|
||||
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
|
||||
*/
|
||||
SlashCommand:
|
||||
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
||||
/**
|
||||
* Regular expression for matching a custom emoji, either static or animated
|
||||
*
|
||||
|
||||
@@ -58,3 +58,41 @@ export const PermissionFlagsBits = {
|
||||
Object.freeze(PermissionFlagsBits);
|
||||
|
||||
export type LocalizationMap = Partial<Record<LocaleString, string | null>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json
|
||||
*/
|
||||
export interface RESTError {
|
||||
code: number;
|
||||
message: string;
|
||||
errors?: RESTErrorData;
|
||||
}
|
||||
|
||||
export interface RESTErrorFieldInformation {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RESTErrorGroupWrapper {
|
||||
_errors: RESTErrorData[];
|
||||
}
|
||||
|
||||
export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure
|
||||
*/
|
||||
export interface RESTRateLimit {
|
||||
/**
|
||||
* A value indicating if you are being globally rate limited or not
|
||||
*/
|
||||
global: boolean;
|
||||
/**
|
||||
* A message saying you are being rate limited.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* The number of seconds to wait before submitting another request.
|
||||
*/
|
||||
retry_after: number;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import type {
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/base.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
|
||||
@@ -18,6 +18,9 @@ export interface ModalSubmitActionRowComponent
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure
|
||||
*/
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
@@ -26,7 +29,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,4 +129,5 @@ export enum ApplicationFlags {
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
ApplicationCommandBadge = 1 << 23,
|
||||
}
|
||||
|
||||
@@ -42,18 +42,15 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
|
||||
export type TextChannelType =
|
||||
| ChannelType.DM
|
||||
| ChannelType.GroupDM
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildPublicThread
|
||||
| ChannelType.GuildPrivateThread
|
||||
| ChannelType.GuildNewsThread
|
||||
| ChannelType.GuildAnnouncement
|
||||
| ChannelType.PublicThread
|
||||
| ChannelType.PrivateThread
|
||||
| ChannelType.AnnouncementThread
|
||||
| ChannelType.GuildText
|
||||
| ChannelType.GuildForum
|
||||
| ChannelType.GuildVoice;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
export type GuildChannelType = Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
@@ -111,7 +108,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
*/
|
||||
default_auto_archive_duration?: ThreadAutoArchiveDuration;
|
||||
/**
|
||||
* The channel topic (0-1024 characters)
|
||||
* The channel topic (0-4096 characters for forum channels, 0-1024 characters for all others)
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
@@ -122,7 +119,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
}
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
|
||||
@@ -190,9 +187,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
}
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends APIGuildChannel<
|
||||
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
|
||||
> {
|
||||
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -235,9 +230,85 @@ export interface APIThreadChannel
|
||||
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
|
||||
*/
|
||||
total_message_sent?: number;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
|
||||
*/
|
||||
export interface APIGuildForumTag {
|
||||
/**
|
||||
* The id of the tag
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the tag (0-20 characters)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
|
||||
*/
|
||||
moderated: boolean;
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
|
||||
*/
|
||||
export interface APIGuildForumDefaultReactionEmoji {
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
|
||||
*/
|
||||
export enum SortOrderType {
|
||||
/**
|
||||
* Sort forum posts by activity
|
||||
*/
|
||||
LatestActivity,
|
||||
/**
|
||||
* Sort forum posts by creation time (from most recent to oldest)
|
||||
*/
|
||||
CreationDate,
|
||||
}
|
||||
|
||||
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*/
|
||||
available_tags: APIGuildForumTag[];
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number;
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*/
|
||||
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*/
|
||||
default_sort_order: SortOrderType | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
@@ -285,19 +356,19 @@ export enum ChannelType {
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews,
|
||||
GuildAnnouncement,
|
||||
/**
|
||||
* A thread channel (public) within a Guild News channel
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
AnnouncementThread = 10,
|
||||
/**
|
||||
* A public thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*/
|
||||
GuildPublicThread,
|
||||
PublicThread,
|
||||
/**
|
||||
* A private thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*/
|
||||
GuildPrivateThread,
|
||||
PrivateThread,
|
||||
/**
|
||||
* A voice channel for hosting events with an audience
|
||||
*
|
||||
@@ -314,6 +385,35 @@ export enum ChannelType {
|
||||
* A channel that can only contain threads
|
||||
*/
|
||||
GuildForum,
|
||||
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
* A channel that users can follow and crosspost into their own guild
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#GuildAnnouncement}
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews = 5,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PublicThread}
|
||||
*/
|
||||
GuildPublicThread = 11,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PrivateThread}
|
||||
*/
|
||||
GuildPrivateThread = 12,
|
||||
}
|
||||
|
||||
export enum VideoQualityMode {
|
||||
@@ -1405,7 +1505,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
||||
*/
|
||||
export enum ChannelFlags {
|
||||
/**
|
||||
* This thread is pinned to the top of its parent forum channel
|
||||
*/
|
||||
Pinned = 1 << 1,
|
||||
/**
|
||||
* Whether a tag is required to be specified when creating a thread in a forum channel.
|
||||
* Tags are specified in the `applied_tags` field
|
||||
*/
|
||||
RequireTag = 1 << 4,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import type { APIEmoji } from './emoji.ts';
|
||||
import type { PresenceUpdateStatus } from './gateway.ts';
|
||||
import type { OAuth2Scopes } from './oauth2.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -117,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
afk_channel_id: Snowflake | null;
|
||||
/**
|
||||
* afk timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout: number;
|
||||
/**
|
||||
@@ -409,6 +410,10 @@ export enum GuildFeature {
|
||||
* @unstable This feature is currently not documented by Discord, but has known value
|
||||
*/
|
||||
Hub = 'HUB',
|
||||
/**
|
||||
* Guild has disabled invite usage, preventing users from joining
|
||||
*/
|
||||
InvitesDisabled = 'INVITES_DISABLED',
|
||||
/**
|
||||
* Guild has access to set an invite splash background
|
||||
*/
|
||||
@@ -698,6 +703,10 @@ export interface APIGuildIntegration {
|
||||
* **This field is not provided for `discord` bot integrations.**
|
||||
*/
|
||||
application?: APIGuildIntegrationApplication;
|
||||
/**
|
||||
* The scopes the application has been authorized for
|
||||
*/
|
||||
scopes?: OAuth2Scopes[];
|
||||
}
|
||||
|
||||
export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord';
|
||||
|
||||
@@ -204,6 +204,10 @@ export interface APIConnection {
|
||||
* Whether activities related to this connection will be shown in presence updates
|
||||
*/
|
||||
show_activity: boolean;
|
||||
/**
|
||||
* Whether this connection supports console voice transfer
|
||||
*/
|
||||
two_way_link: boolean;
|
||||
/**
|
||||
* Visibility of this connection
|
||||
*
|
||||
@@ -214,13 +218,15 @@ export interface APIConnection {
|
||||
|
||||
export enum ConnectionService {
|
||||
BattleNet = 'battlenet',
|
||||
eBay = 'ebay',
|
||||
EpicGames = 'epicgames',
|
||||
Facebook = 'facebook',
|
||||
GitHub = 'github',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
SamsungGalaxy = 'samsunggalaxy',
|
||||
RiotGames = 'riotgames',
|
||||
Spotify = 'spotify',
|
||||
Skype = 'skype',
|
||||
Steam = 'steam',
|
||||
|
||||
@@ -54,6 +54,7 @@ import type {
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/base.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
|
||||
@@ -18,6 +18,9 @@ export interface ModalSubmitActionRowComponent
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure
|
||||
*/
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
@@ -26,7 +29,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,4 +129,5 @@ export enum ApplicationFlags {
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
ApplicationCommandBadge = 1 << 23,
|
||||
}
|
||||
|
||||
@@ -42,18 +42,15 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
|
||||
export type TextChannelType =
|
||||
| ChannelType.DM
|
||||
| ChannelType.GroupDM
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildPublicThread
|
||||
| ChannelType.GuildPrivateThread
|
||||
| ChannelType.GuildNewsThread
|
||||
| ChannelType.GuildAnnouncement
|
||||
| ChannelType.PublicThread
|
||||
| ChannelType.PrivateThread
|
||||
| ChannelType.AnnouncementThread
|
||||
| ChannelType.GuildText
|
||||
| ChannelType.GuildForum
|
||||
| ChannelType.GuildVoice;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
export type GuildChannelType = Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
@@ -122,7 +119,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
}
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
|
||||
@@ -190,9 +187,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
}
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends APIGuildChannel<
|
||||
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
|
||||
> {
|
||||
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -235,9 +230,85 @@ export interface APIThreadChannel
|
||||
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
|
||||
*/
|
||||
total_message_sent?: number;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
|
||||
*/
|
||||
export interface APIGuildForumTag {
|
||||
/**
|
||||
* The id of the tag
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the tag (0-20 characters)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
|
||||
*/
|
||||
moderated: boolean;
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
|
||||
*/
|
||||
export interface APIGuildForumDefaultReactionEmoji {
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
|
||||
*/
|
||||
export enum SortOrderType {
|
||||
/**
|
||||
* Sort forum posts by activity
|
||||
*/
|
||||
LatestActivity,
|
||||
/**
|
||||
* Sort forum posts by creation time (from most recent to oldest)
|
||||
*/
|
||||
CreationDate,
|
||||
}
|
||||
|
||||
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*/
|
||||
available_tags: APIGuildForumTag[];
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number;
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*/
|
||||
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*/
|
||||
default_sort_order: SortOrderType | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
@@ -285,19 +356,19 @@ export enum ChannelType {
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews,
|
||||
GuildAnnouncement,
|
||||
/**
|
||||
* A thread channel (public) within a Guild News channel
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
AnnouncementThread = 10,
|
||||
/**
|
||||
* A public thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*/
|
||||
GuildPublicThread,
|
||||
PublicThread,
|
||||
/**
|
||||
* A private thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*/
|
||||
GuildPrivateThread,
|
||||
PrivateThread,
|
||||
/**
|
||||
* A voice channel for hosting events with an audience
|
||||
*
|
||||
@@ -314,6 +385,34 @@ export enum ChannelType {
|
||||
* A channel that can only contain threads
|
||||
*/
|
||||
GuildForum,
|
||||
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS
|
||||
/**
|
||||
* A channel that users can follow and crosspost into their own guild
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#GuildAnnouncement}
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews = 5,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PublicThread}
|
||||
*/
|
||||
GuildPublicThread = 11,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PrivateThread}
|
||||
*/
|
||||
GuildPrivateThread = 12,
|
||||
}
|
||||
|
||||
export enum VideoQualityMode {
|
||||
@@ -1405,7 +1504,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
||||
*/
|
||||
export enum ChannelFlags {
|
||||
/**
|
||||
* This thread is pinned to the top of its parent forum channel
|
||||
*/
|
||||
Pinned = 1 << 1,
|
||||
/**
|
||||
* Whether a tag is required to be specified when creating a thread in a forum channel.
|
||||
* Tags are specified in the `applied_tags` field
|
||||
*/
|
||||
RequireTag = 1 << 4,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import type { APIEmoji } from './emoji.ts';
|
||||
import type { PresenceUpdateStatus } from './gateway.ts';
|
||||
import type { OAuth2Scopes } from './oauth2.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -117,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
afk_channel_id: Snowflake | null;
|
||||
/**
|
||||
* afk timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout: number;
|
||||
/**
|
||||
@@ -409,6 +410,10 @@ export enum GuildFeature {
|
||||
* @unstable This feature is currently not documented by Discord, but has known value
|
||||
*/
|
||||
Hub = 'HUB',
|
||||
/**
|
||||
* Guild has disabled invite usage, preventing users from joining
|
||||
*/
|
||||
InvitesDisabled = 'INVITES_DISABLED',
|
||||
/**
|
||||
* Guild has access to set an invite splash background
|
||||
*/
|
||||
@@ -698,6 +703,10 @@ export interface APIGuildIntegration {
|
||||
* **This field is not provided for `discord` bot integrations.**
|
||||
*/
|
||||
application?: APIGuildIntegrationApplication;
|
||||
/**
|
||||
* The scopes the application has been authorized for
|
||||
*/
|
||||
scopes?: OAuth2Scopes[];
|
||||
}
|
||||
|
||||
export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord';
|
||||
|
||||
@@ -204,6 +204,10 @@ export interface APIConnection {
|
||||
* Whether activities related to this connection will be shown in presence updates
|
||||
*/
|
||||
show_activity: boolean;
|
||||
/**
|
||||
* Whether this connection supports console voice transfer
|
||||
*/
|
||||
two_way_link: boolean;
|
||||
/**
|
||||
* Visibility of this connection
|
||||
*
|
||||
@@ -214,13 +218,15 @@ export interface APIConnection {
|
||||
|
||||
export enum ConnectionService {
|
||||
BattleNet = 'battlenet',
|
||||
eBay = 'ebay',
|
||||
EpicGames = 'epicgames',
|
||||
Facebook = 'facebook',
|
||||
GitHub = 'github',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
SamsungGalaxy = 'samsunggalaxy',
|
||||
RiotGames = 'riotgames',
|
||||
PayPal = 'paypal',
|
||||
Spotify = 'spotify',
|
||||
Skype = 'skype',
|
||||
Steam = 'steam',
|
||||
|
||||
@@ -137,9 +137,14 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
ApplicationInteractionFailedToSend = 40043,
|
||||
|
||||
CannotSendAMessageInAForumChannel = 40058,
|
||||
|
||||
InteractionHasAlreadyBeenAcknowledged = 40060,
|
||||
TagNamesMustBeUnique,
|
||||
|
||||
ThereAreNoTagsAvailableThatCanBeSetByNonModerators = 40066,
|
||||
TagRequiredToCreateAForumPostInThisChannel,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
CannotExecuteActionOnDMChannel,
|
||||
@@ -246,7 +251,12 @@ export enum RESTJSONErrorCodes {
|
||||
MessageWasBlockedByAutomaticModeration = 200000,
|
||||
TitleWasBlockedByAutomaticModeration,
|
||||
|
||||
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
|
||||
WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220001,
|
||||
WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId,
|
||||
WebhooksCanOnlyCreateThreadsInForumChannels,
|
||||
WebhookServicesCannotBeUsedInForumChannels,
|
||||
|
||||
MessageBlockedByHarmfulLinksFilter = 240000,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,9 @@ import type {
|
||||
OverwriteType,
|
||||
ThreadAutoArchiveDuration,
|
||||
VideoQualityMode,
|
||||
APIGuildForumTag,
|
||||
APIGuildForumDefaultReactionEmoji,
|
||||
SortOrderType,
|
||||
} from '../../payloads/v10/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
|
||||
@@ -48,7 +51,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: text, news
|
||||
*/
|
||||
type?: ChannelType.GuildNews | ChannelType.GuildText;
|
||||
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
|
||||
/**
|
||||
* The position of the channel in the left-hand listing
|
||||
*
|
||||
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*/
|
||||
position?: number | null;
|
||||
/**
|
||||
* 0-1024 character channel topic
|
||||
* 0-1024 character channel topic (0-4096 characters for forum channels)
|
||||
*
|
||||
* Channel types: text, news
|
||||
* Channel types: text, news, forum
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*
|
||||
* Channel types: text, voice, news
|
||||
* Channel types: text, voice, news, forum
|
||||
*/
|
||||
nsfw?: boolean | null;
|
||||
/**
|
||||
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
|
||||
* are unaffected
|
||||
*
|
||||
* Channel types: text, newsThread, publicThread, privateThread
|
||||
* Channel types: text, newsThread, publicThread, privateThread, forum
|
||||
*/
|
||||
rate_limit_per_user?: number | null;
|
||||
/**
|
||||
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* Channel types: privateThread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
available_tags?: APIGuildForumTag[];
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*
|
||||
* Channel types: text, forum
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_sort_order?: SortOrderType | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -589,6 +617,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
|
||||
* First message in the forum thread
|
||||
*/
|
||||
message: RESTPostAPIChannelMessageJSONBody;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags?: Snowflake[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -619,9 +651,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default ChannelType.GuildPrivateThread
|
||||
* @default ChannelType.PrivateThread
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
| 'rtc_region'
|
||||
| 'video_quality_mode'
|
||||
| 'flags'
|
||||
| 'default_reaction_emoji'
|
||||
| 'available_tags'
|
||||
| 'default_sort_order'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: number | Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -573,8 +576,14 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*
|
||||
* @deprecated use `delete_message_seconds` instead
|
||||
*/
|
||||
delete_message_days?: number;
|
||||
/**
|
||||
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
|
||||
*/
|
||||
delete_message_seconds?: number;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -855,7 +864,7 @@ export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPos
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
channel_id: Snowflake;
|
||||
channel_id?: Snowflake;
|
||||
/**
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,9 @@ import type {
|
||||
OverwriteType,
|
||||
ThreadAutoArchiveDuration,
|
||||
VideoQualityMode,
|
||||
APIGuildForumTag,
|
||||
APIGuildForumDefaultReactionEmoji,
|
||||
SortOrderType,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
|
||||
@@ -48,7 +51,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: text, news
|
||||
*/
|
||||
type?: ChannelType.GuildNews | ChannelType.GuildText;
|
||||
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
|
||||
/**
|
||||
* The position of the channel in the left-hand listing
|
||||
*
|
||||
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*/
|
||||
position?: number | null;
|
||||
/**
|
||||
* 0-1024 character channel topic
|
||||
* 0-1024 character channel topic (0-4096 characters for forum channels)
|
||||
*
|
||||
* Channel types: text, news
|
||||
* Channel types: text, news, forum
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*
|
||||
* Channel types: text, voice, news
|
||||
* Channel types: text, voice, news, forum
|
||||
*/
|
||||
nsfw?: boolean | null;
|
||||
/**
|
||||
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
|
||||
* are unaffected
|
||||
*
|
||||
* Channel types: text, newsThread, publicThread, privateThread
|
||||
* Channel types: text, newsThread, publicThread, privateThread, forum
|
||||
*/
|
||||
rate_limit_per_user?: number | null;
|
||||
/**
|
||||
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* Channel types: privateThread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
available_tags?: APIGuildForumTag[];
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*
|
||||
* Channel types: text, forum
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_sort_order?: SortOrderType | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -603,6 +631,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
|
||||
* First message in the forum thread
|
||||
*/
|
||||
message: RESTPostAPIChannelMessageJSONBody;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags?: Snowflake[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -633,9 +665,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default ChannelType.GuildPrivateThread
|
||||
* @default ChannelType.PrivateThread
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
| 'rtc_region'
|
||||
| 'video_quality_mode'
|
||||
| 'flags'
|
||||
| 'default_reaction_emoji'
|
||||
| 'available_tags'
|
||||
| 'default_sort_order'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: number | Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -573,8 +576,14 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*
|
||||
* @deprecated use `delete_message_seconds` instead
|
||||
*/
|
||||
delete_message_days?: number;
|
||||
/**
|
||||
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
|
||||
*/
|
||||
delete_message_seconds?: number;
|
||||
/**
|
||||
* Reason for the ban
|
||||
*
|
||||
@@ -861,7 +870,7 @@ export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPos
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
channel_id: Snowflake;
|
||||
channel_id?: Snowflake;
|
||||
/**
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,13 @@ export const FormattingPatterns = {
|
||||
* The `id` group property is present on the `exec` result of this expression
|
||||
*/
|
||||
Role: /<@&(?<id>\d{17,20})>/,
|
||||
/**
|
||||
* Regular expression for matching a application command mention
|
||||
*
|
||||
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
|
||||
*/
|
||||
SlashCommand:
|
||||
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
||||
/**
|
||||
* Regular expression for matching a custom emoji, either static or animated
|
||||
*
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.37.2",
|
||||
"version": "0.37.12",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "discord-api-types",
|
||||
"version": "0.37.2",
|
||||
"version": "0.37.12",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/runtime-corejs3": "^7.18.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.37.2",
|
||||
"version": "0.37.12",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"homepage": "https://discord-api-types.dev",
|
||||
"exports": {
|
||||
|
||||
@@ -58,3 +58,41 @@ export const PermissionFlagsBits = {
|
||||
Object.freeze(PermissionFlagsBits);
|
||||
|
||||
export type LocalizationMap = Partial<Record<LocaleString, string | null>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json
|
||||
*/
|
||||
export interface RESTError {
|
||||
code: number;
|
||||
message: string;
|
||||
errors?: RESTErrorData;
|
||||
}
|
||||
|
||||
export interface RESTErrorFieldInformation {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RESTErrorGroupWrapper {
|
||||
_errors: RESTErrorData[];
|
||||
}
|
||||
|
||||
export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure
|
||||
*/
|
||||
export interface RESTRateLimit {
|
||||
/**
|
||||
* A value indicating if you are being globally rate limited or not
|
||||
*/
|
||||
global: boolean;
|
||||
/**
|
||||
* A message saying you are being rate limited.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* The number of seconds to wait before submitting another request.
|
||||
*/
|
||||
retry_after: number;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import type {
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
|
||||
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/base';
|
||||
export * from './_chatInput/boolean';
|
||||
export * from './_chatInput/channel';
|
||||
export * from './_chatInput/integer';
|
||||
|
||||
@@ -18,6 +18,9 @@ export interface ModalSubmitActionRowComponent
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure
|
||||
*/
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
@@ -26,7 +29,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,4 +129,5 @@ export enum ApplicationFlags {
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
ApplicationCommandBadge = 1 << 23,
|
||||
}
|
||||
|
||||
@@ -42,18 +42,15 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
|
||||
export type TextChannelType =
|
||||
| ChannelType.DM
|
||||
| ChannelType.GroupDM
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildPublicThread
|
||||
| ChannelType.GuildPrivateThread
|
||||
| ChannelType.GuildNewsThread
|
||||
| ChannelType.GuildAnnouncement
|
||||
| ChannelType.PublicThread
|
||||
| ChannelType.PrivateThread
|
||||
| ChannelType.AnnouncementThread
|
||||
| ChannelType.GuildText
|
||||
| ChannelType.GuildForum
|
||||
| ChannelType.GuildVoice;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
export type GuildChannelType = Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
@@ -111,7 +108,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
*/
|
||||
default_auto_archive_duration?: ThreadAutoArchiveDuration;
|
||||
/**
|
||||
* The channel topic (0-1024 characters)
|
||||
* The channel topic (0-4096 characters for forum channels, 0-1024 characters for all others)
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
@@ -122,7 +119,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
}
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
|
||||
@@ -190,9 +187,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
}
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends APIGuildChannel<
|
||||
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
|
||||
> {
|
||||
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -235,9 +230,85 @@ export interface APIThreadChannel
|
||||
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
|
||||
*/
|
||||
total_message_sent?: number;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
|
||||
*/
|
||||
export interface APIGuildForumTag {
|
||||
/**
|
||||
* The id of the tag
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the tag (0-20 characters)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
|
||||
*/
|
||||
moderated: boolean;
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
|
||||
*/
|
||||
export interface APIGuildForumDefaultReactionEmoji {
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
|
||||
*/
|
||||
export enum SortOrderType {
|
||||
/**
|
||||
* Sort forum posts by activity
|
||||
*/
|
||||
LatestActivity,
|
||||
/**
|
||||
* Sort forum posts by creation time (from most recent to oldest)
|
||||
*/
|
||||
CreationDate,
|
||||
}
|
||||
|
||||
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*/
|
||||
available_tags: APIGuildForumTag[];
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number;
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*/
|
||||
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*/
|
||||
default_sort_order: SortOrderType | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
@@ -285,19 +356,19 @@ export enum ChannelType {
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews,
|
||||
GuildAnnouncement,
|
||||
/**
|
||||
* A thread channel (public) within a Guild News channel
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
AnnouncementThread = 10,
|
||||
/**
|
||||
* A public thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*/
|
||||
GuildPublicThread,
|
||||
PublicThread,
|
||||
/**
|
||||
* A private thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*/
|
||||
GuildPrivateThread,
|
||||
PrivateThread,
|
||||
/**
|
||||
* A voice channel for hosting events with an audience
|
||||
*
|
||||
@@ -314,6 +385,35 @@ export enum ChannelType {
|
||||
* A channel that can only contain threads
|
||||
*/
|
||||
GuildForum,
|
||||
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
* A channel that users can follow and crosspost into their own guild
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#GuildAnnouncement}
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews = 5,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PublicThread}
|
||||
*/
|
||||
GuildPublicThread = 11,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PrivateThread}
|
||||
*/
|
||||
GuildPrivateThread = 12,
|
||||
}
|
||||
|
||||
export enum VideoQualityMode {
|
||||
@@ -1405,7 +1505,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
||||
*/
|
||||
export enum ChannelFlags {
|
||||
/**
|
||||
* This thread is pinned to the top of its parent forum channel
|
||||
*/
|
||||
Pinned = 1 << 1,
|
||||
/**
|
||||
* Whether a tag is required to be specified when creating a thread in a forum channel.
|
||||
* Tags are specified in the `applied_tags` field
|
||||
*/
|
||||
RequireTag = 1 << 4,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import type { APIEmoji } from './emoji';
|
||||
import type { PresenceUpdateStatus } from './gateway';
|
||||
import type { OAuth2Scopes } from './oauth2';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -117,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
afk_channel_id: Snowflake | null;
|
||||
/**
|
||||
* afk timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout: number;
|
||||
/**
|
||||
@@ -409,6 +410,10 @@ export enum GuildFeature {
|
||||
* @unstable This feature is currently not documented by Discord, but has known value
|
||||
*/
|
||||
Hub = 'HUB',
|
||||
/**
|
||||
* Guild has disabled invite usage, preventing users from joining
|
||||
*/
|
||||
InvitesDisabled = 'INVITES_DISABLED',
|
||||
/**
|
||||
* Guild has access to set an invite splash background
|
||||
*/
|
||||
@@ -698,6 +703,10 @@ export interface APIGuildIntegration {
|
||||
* **This field is not provided for `discord` bot integrations.**
|
||||
*/
|
||||
application?: APIGuildIntegrationApplication;
|
||||
/**
|
||||
* The scopes the application has been authorized for
|
||||
*/
|
||||
scopes?: OAuth2Scopes[];
|
||||
}
|
||||
|
||||
export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord';
|
||||
|
||||
@@ -204,6 +204,10 @@ export interface APIConnection {
|
||||
* Whether activities related to this connection will be shown in presence updates
|
||||
*/
|
||||
show_activity: boolean;
|
||||
/**
|
||||
* Whether this connection supports console voice transfer
|
||||
*/
|
||||
two_way_link: boolean;
|
||||
/**
|
||||
* Visibility of this connection
|
||||
*
|
||||
@@ -214,13 +218,15 @@ export interface APIConnection {
|
||||
|
||||
export enum ConnectionService {
|
||||
BattleNet = 'battlenet',
|
||||
eBay = 'ebay',
|
||||
EpicGames = 'epicgames',
|
||||
Facebook = 'facebook',
|
||||
GitHub = 'github',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
SamsungGalaxy = 'samsunggalaxy',
|
||||
RiotGames = 'riotgames',
|
||||
Spotify = 'spotify',
|
||||
Skype = 'skype',
|
||||
Steam = 'steam',
|
||||
|
||||
@@ -54,6 +54,7 @@ import type {
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
|
||||
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/base';
|
||||
export * from './_chatInput/boolean';
|
||||
export * from './_chatInput/channel';
|
||||
export * from './_chatInput/integer';
|
||||
|
||||
@@ -18,6 +18,9 @@ export interface ModalSubmitActionRowComponent
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure
|
||||
*/
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
@@ -26,7 +29,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,4 +129,5 @@ export enum ApplicationFlags {
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
ApplicationCommandBadge = 1 << 23,
|
||||
}
|
||||
|
||||
@@ -42,18 +42,15 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
|
||||
export type TextChannelType =
|
||||
| ChannelType.DM
|
||||
| ChannelType.GroupDM
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildPublicThread
|
||||
| ChannelType.GuildPrivateThread
|
||||
| ChannelType.GuildNewsThread
|
||||
| ChannelType.GuildAnnouncement
|
||||
| ChannelType.PublicThread
|
||||
| ChannelType.PrivateThread
|
||||
| ChannelType.AnnouncementThread
|
||||
| ChannelType.GuildText
|
||||
| ChannelType.GuildForum
|
||||
| ChannelType.GuildVoice;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
export type GuildChannelType = Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
@@ -122,7 +119,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
}
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
|
||||
@@ -190,9 +187,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
}
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends APIGuildChannel<
|
||||
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
|
||||
> {
|
||||
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -235,9 +230,85 @@ export interface APIThreadChannel
|
||||
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
|
||||
*/
|
||||
total_message_sent?: number;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
|
||||
*/
|
||||
export interface APIGuildForumTag {
|
||||
/**
|
||||
* The id of the tag
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the tag (0-20 characters)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
|
||||
*/
|
||||
moderated: boolean;
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
|
||||
*/
|
||||
export interface APIGuildForumDefaultReactionEmoji {
|
||||
/**
|
||||
* The id of a guild's custom emoji
|
||||
*/
|
||||
emoji_id: Snowflake | null;
|
||||
/**
|
||||
* The unicode character of the emoji
|
||||
*/
|
||||
emoji_name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
|
||||
*/
|
||||
export enum SortOrderType {
|
||||
/**
|
||||
* Sort forum posts by activity
|
||||
*/
|
||||
LatestActivity,
|
||||
/**
|
||||
* Sort forum posts by creation time (from most recent to oldest)
|
||||
*/
|
||||
CreationDate,
|
||||
}
|
||||
|
||||
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*/
|
||||
available_tags: APIGuildForumTag[];
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number;
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*/
|
||||
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*/
|
||||
default_sort_order: SortOrderType | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
@@ -285,19 +356,19 @@ export enum ChannelType {
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews,
|
||||
GuildAnnouncement,
|
||||
/**
|
||||
* A thread channel (public) within a Guild News channel
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
AnnouncementThread = 10,
|
||||
/**
|
||||
* A public thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*/
|
||||
GuildPublicThread,
|
||||
PublicThread,
|
||||
/**
|
||||
* A private thread channel within a Guild Text channel
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*/
|
||||
GuildPrivateThread,
|
||||
PrivateThread,
|
||||
/**
|
||||
* A voice channel for hosting events with an audience
|
||||
*
|
||||
@@ -314,6 +385,34 @@ export enum ChannelType {
|
||||
* A channel that can only contain threads
|
||||
*/
|
||||
GuildForum,
|
||||
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS
|
||||
/**
|
||||
* A channel that users can follow and crosspost into their own guild
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#GuildAnnouncement}
|
||||
*
|
||||
* See https://support.discord.com/hc/en-us/articles/360032008192
|
||||
*/
|
||||
GuildNews = 5,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Announcement channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
|
||||
*/
|
||||
GuildNewsThread = 10,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PublicThread}
|
||||
*/
|
||||
GuildPublicThread = 11,
|
||||
/**
|
||||
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
|
||||
*
|
||||
* @deprecated This is the old name for {@apilink ChannelType#PrivateThread}
|
||||
*/
|
||||
GuildPrivateThread = 12,
|
||||
}
|
||||
|
||||
export enum VideoQualityMode {
|
||||
@@ -1405,7 +1504,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
||||
*/
|
||||
export enum ChannelFlags {
|
||||
/**
|
||||
* This thread is pinned to the top of its parent forum channel
|
||||
*/
|
||||
Pinned = 1 << 1,
|
||||
/**
|
||||
* Whether a tag is required to be specified when creating a thread in a forum channel.
|
||||
* Tags are specified in the `applied_tags` field
|
||||
*/
|
||||
RequireTag = 1 << 4,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import type { APIEmoji } from './emoji';
|
||||
import type { PresenceUpdateStatus } from './gateway';
|
||||
import type { OAuth2Scopes } from './oauth2';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -117,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
afk_channel_id: Snowflake | null;
|
||||
/**
|
||||
* afk timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout: number;
|
||||
/**
|
||||
@@ -409,6 +410,10 @@ export enum GuildFeature {
|
||||
* @unstable This feature is currently not documented by Discord, but has known value
|
||||
*/
|
||||
Hub = 'HUB',
|
||||
/**
|
||||
* Guild has disabled invite usage, preventing users from joining
|
||||
*/
|
||||
InvitesDisabled = 'INVITES_DISABLED',
|
||||
/**
|
||||
* Guild has access to set an invite splash background
|
||||
*/
|
||||
@@ -698,6 +703,10 @@ export interface APIGuildIntegration {
|
||||
* **This field is not provided for `discord` bot integrations.**
|
||||
*/
|
||||
application?: APIGuildIntegrationApplication;
|
||||
/**
|
||||
* The scopes the application has been authorized for
|
||||
*/
|
||||
scopes?: OAuth2Scopes[];
|
||||
}
|
||||
|
||||
export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord';
|
||||
|
||||
@@ -204,6 +204,10 @@ export interface APIConnection {
|
||||
* Whether activities related to this connection will be shown in presence updates
|
||||
*/
|
||||
show_activity: boolean;
|
||||
/**
|
||||
* Whether this connection supports console voice transfer
|
||||
*/
|
||||
two_way_link: boolean;
|
||||
/**
|
||||
* Visibility of this connection
|
||||
*
|
||||
@@ -214,13 +218,15 @@ export interface APIConnection {
|
||||
|
||||
export enum ConnectionService {
|
||||
BattleNet = 'battlenet',
|
||||
eBay = 'ebay',
|
||||
EpicGames = 'epicgames',
|
||||
Facebook = 'facebook',
|
||||
GitHub = 'github',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
SamsungGalaxy = 'samsunggalaxy',
|
||||
RiotGames = 'riotgames',
|
||||
PayPal = 'paypal',
|
||||
Spotify = 'spotify',
|
||||
Skype = 'skype',
|
||||
Steam = 'steam',
|
||||
|
||||
@@ -137,9 +137,14 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
ApplicationInteractionFailedToSend = 40043,
|
||||
|
||||
CannotSendAMessageInAForumChannel = 40058,
|
||||
|
||||
InteractionHasAlreadyBeenAcknowledged = 40060,
|
||||
TagNamesMustBeUnique,
|
||||
|
||||
ThereAreNoTagsAvailableThatCanBeSetByNonModerators = 40066,
|
||||
TagRequiredToCreateAForumPostInThisChannel,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
CannotExecuteActionOnDMChannel,
|
||||
@@ -246,7 +251,12 @@ export enum RESTJSONErrorCodes {
|
||||
MessageWasBlockedByAutomaticModeration = 200000,
|
||||
TitleWasBlockedByAutomaticModeration,
|
||||
|
||||
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
|
||||
WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220001,
|
||||
WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId,
|
||||
WebhooksCanOnlyCreateThreadsInForumChannels,
|
||||
WebhookServicesCannotBeUsedInForumChannels,
|
||||
|
||||
MessageBlockedByHarmfulLinksFilter = 240000,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,9 @@ import type {
|
||||
OverwriteType,
|
||||
ThreadAutoArchiveDuration,
|
||||
VideoQualityMode,
|
||||
APIGuildForumTag,
|
||||
APIGuildForumDefaultReactionEmoji,
|
||||
SortOrderType,
|
||||
} from '../../payloads/v10/index';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
|
||||
|
||||
@@ -48,7 +51,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: text, news
|
||||
*/
|
||||
type?: ChannelType.GuildNews | ChannelType.GuildText;
|
||||
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
|
||||
/**
|
||||
* The position of the channel in the left-hand listing
|
||||
*
|
||||
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*/
|
||||
position?: number | null;
|
||||
/**
|
||||
* 0-1024 character channel topic
|
||||
* 0-1024 character channel topic (0-4096 characters for forum channels)
|
||||
*
|
||||
* Channel types: text, news
|
||||
* Channel types: text, news, forum
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*
|
||||
* Channel types: text, voice, news
|
||||
* Channel types: text, voice, news, forum
|
||||
*/
|
||||
nsfw?: boolean | null;
|
||||
/**
|
||||
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
|
||||
* are unaffected
|
||||
*
|
||||
* Channel types: text, newsThread, publicThread, privateThread
|
||||
* Channel types: text, newsThread, publicThread, privateThread, forum
|
||||
*/
|
||||
rate_limit_per_user?: number | null;
|
||||
/**
|
||||
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* Channel types: privateThread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
available_tags?: APIGuildForumTag[];
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*
|
||||
* Channel types: text, forum
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_sort_order?: SortOrderType | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -589,6 +617,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
|
||||
* First message in the forum thread
|
||||
*/
|
||||
message: RESTPostAPIChannelMessageJSONBody;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags?: Snowflake[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -619,9 +651,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default ChannelType.GuildPrivateThread
|
||||
* @default ChannelType.PrivateThread
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
| 'rtc_region'
|
||||
| 'video_quality_mode'
|
||||
| 'flags'
|
||||
| 'default_reaction_emoji'
|
||||
| 'available_tags'
|
||||
| 'default_sort_order'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: number | Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -573,8 +576,14 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*
|
||||
* @deprecated use `delete_message_seconds` instead
|
||||
*/
|
||||
delete_message_days?: number;
|
||||
/**
|
||||
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
|
||||
*/
|
||||
delete_message_seconds?: number;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -855,7 +864,7 @@ export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPos
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
channel_id: Snowflake;
|
||||
channel_id?: Snowflake;
|
||||
/**
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,9 @@ import type {
|
||||
OverwriteType,
|
||||
ThreadAutoArchiveDuration,
|
||||
VideoQualityMode,
|
||||
APIGuildForumTag,
|
||||
APIGuildForumDefaultReactionEmoji,
|
||||
SortOrderType,
|
||||
} from '../../payloads/v9/index';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
|
||||
|
||||
@@ -48,7 +51,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: text, news
|
||||
*/
|
||||
type?: ChannelType.GuildNews | ChannelType.GuildText;
|
||||
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
|
||||
/**
|
||||
* The position of the channel in the left-hand listing
|
||||
*
|
||||
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*/
|
||||
position?: number | null;
|
||||
/**
|
||||
* 0-1024 character channel topic
|
||||
* 0-1024 character channel topic (0-4096 characters for forum channels)
|
||||
*
|
||||
* Channel types: text, news
|
||||
* Channel types: text, news, forum
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*
|
||||
* Channel types: text, voice, news
|
||||
* Channel types: text, voice, news, forum
|
||||
*/
|
||||
nsfw?: boolean | null;
|
||||
/**
|
||||
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
|
||||
* are unaffected
|
||||
*
|
||||
* Channel types: text, newsThread, publicThread, privateThread
|
||||
* Channel types: text, newsThread, publicThread, privateThread, forum
|
||||
*/
|
||||
rate_limit_per_user?: number | null;
|
||||
/**
|
||||
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
* Channel types: privateThread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
/**
|
||||
* The set of tags that can be used in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
available_tags?: APIGuildForumTag[];
|
||||
/**
|
||||
* The emoji to show in the add reaction button on a thread in a forum channel
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
|
||||
/**
|
||||
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
|
||||
* This field is copied to the thread at creation time and does not live update
|
||||
*
|
||||
* Channel types: text, forum
|
||||
*/
|
||||
default_thread_rate_limit_per_user?: number | null;
|
||||
/**
|
||||
* The default sort order type used to order posts in forum channels
|
||||
*
|
||||
* Channel types: forum
|
||||
*/
|
||||
default_sort_order?: SortOrderType | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -603,6 +631,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
|
||||
* First message in the forum thread
|
||||
*/
|
||||
message: RESTPostAPIChannelMessageJSONBody;
|
||||
/**
|
||||
* The IDs of the set of tags that have been applied to a thread in a forum channel
|
||||
*/
|
||||
applied_tags?: Snowflake[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -633,9 +665,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default ChannelType.GuildPrivateThread
|
||||
* @default ChannelType.PrivateThread
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
| 'rtc_region'
|
||||
| 'video_quality_mode'
|
||||
| 'flags'
|
||||
| 'default_reaction_emoji'
|
||||
| 'available_tags'
|
||||
| 'default_sort_order'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: number | Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
|
||||
*/
|
||||
afk_channel_id?: Snowflake | null;
|
||||
/**
|
||||
* AFK timeout in seconds
|
||||
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
||||
*/
|
||||
afk_timeout?: number;
|
||||
/**
|
||||
@@ -573,8 +576,14 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*
|
||||
* @deprecated use `delete_message_seconds` instead
|
||||
*/
|
||||
delete_message_days?: number;
|
||||
/**
|
||||
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
|
||||
*/
|
||||
delete_message_seconds?: number;
|
||||
/**
|
||||
* Reason for the ban
|
||||
*
|
||||
@@ -861,7 +870,7 @@ export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPos
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
channel_id: Snowflake;
|
||||
channel_id?: Snowflake;
|
||||
/**
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
|
||||
@@ -190,6 +190,7 @@ const config = {
|
||||
items: [
|
||||
{ label: versions.length === 0 ? 'Development Time' : 'next 🚧', to: versions.length === 0 ? 'api' : 'api/next' },
|
||||
...versions.map((version, i) => ({
|
||||
activeBaseRegex: `api/(${version}/)${i === 0 ? '?' : ''}discord-api-types.*`,
|
||||
label: version,
|
||||
to: i === 0 ? 'api' : `api/${version}`
|
||||
}))
|
||||
@@ -257,7 +258,7 @@ const config = {
|
||||
appId: 'TR1O0DBFL9',
|
||||
apiKey: '6822440beca69053ab122881d75064dc',
|
||||
indexName: 'discord-api-types',
|
||||
contextualSearch: false
|
||||
contextualSearch: true
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
1412
website/package-lock.json
generated
1412
website/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -48,3 +48,40 @@
|
||||
.navbar__toggle {
|
||||
color: #f5f6f7;
|
||||
}
|
||||
|
||||
// Search
|
||||
[data-theme='light'] .DocSearch {
|
||||
/* --docsearch-primary-color: var(--ifm-color-primary); */
|
||||
/* --docsearch-text-color: var(--ifm-font-color-base); */
|
||||
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
|
||||
--docsearch-container-background: rgba(94, 100, 112, 0.7);
|
||||
/* Modal */
|
||||
--docsearch-modal-background: var(--ifm-color-secondary-lighter);
|
||||
/* Search box */
|
||||
--docsearch-searchbox-background: var(--ifm-color-secondary);
|
||||
--docsearch-searchbox-focus-background: var(--ifm-color-white);
|
||||
/* Hit */
|
||||
--docsearch-hit-color: var(--ifm-font-color-base);
|
||||
--docsearch-hit-active-color: var(--ifm-color-white);
|
||||
--docsearch-hit-background: var(--ifm-color-white);
|
||||
/* Footer */
|
||||
--docsearch-footer-background: var(--ifm-color-white);
|
||||
}
|
||||
|
||||
[data-theme='dark'] .DocSearch {
|
||||
--docsearch-text-color: var(--ifm-font-color-base);
|
||||
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
|
||||
--docsearch-container-background: rgba(47, 55, 69, 0.7);
|
||||
/* Modal */
|
||||
--docsearch-modal-background: var(--ifm-background-color);
|
||||
/* Search box */
|
||||
--docsearch-searchbox-background: var(--ifm-background-color);
|
||||
--docsearch-searchbox-focus-background: var(--ifm-color-black);
|
||||
/* Hit */
|
||||
--docsearch-hit-color: var(--ifm-font-color-base);
|
||||
--docsearch-hit-active-color: var(--ifm-color-white);
|
||||
--docsearch-hit-background: var(--ifm-color-emphasis-100);
|
||||
/* Footer */
|
||||
--docsearch-footer-background: var(--ifm-background-surface-color);
|
||||
--docsearch-key-gradient: linear-gradient(-26.5deg, var(--ifm-color-emphasis-200) 0%, var(--ifm-color-emphasis-100) 100%);
|
||||
}
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
---
|
||||
id: contributing_to_discord-api-types
|
||||
title: How to Contribute
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
So, you'd like to contribute to `discord-api-types` but don't know where to start or what to do? Here are some of the
|
||||
things you need to keep in mind before opening a pull request!
|
||||
|
||||
:::tip Before you begin
|
||||
|
||||
We recommend you contribute either through locally editing the files on your desktop (which means also installing
|
||||
[`npm`](https://www.npmjs.com/) dependencies as this will ensure not only a consistent code style, but also that the
|
||||
`deno` types stay in sync automatically) or through a service like
|
||||
[`GitHub Codespaces`](https://github.com/features/codespaces).
|
||||
|
||||
:::
|
||||
|
||||
:::info Still can't figure it out?
|
||||
|
||||
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the
|
||||
`#discord-api-types-help` channel (under the `Miscellaneous` category)
|
||||
|
||||
:::
|
||||
|
||||
### Install npm dependencies first
|
||||
|
||||
One of the most crucial steps is installing [`npm`](https://www.npmjs.com/) dependencies via `npm ci`. This ensures that
|
||||
linting can be done, and it also sets up the `git` hooks for building the `deno` types and automatically
|
||||
formatting/linting the code when you commit it.
|
||||
|
||||
If you forget to install [`npm`](https://www.npmjs.com/) dependencies, or are doing the contributions through other
|
||||
means (like directly from GitHub web), you might see a comment like this one being sent as a review to your pull
|
||||
request:
|
||||
|
||||

|
||||
|
||||
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
|
||||
|
||||
### Figure out if the update you want to contribute respects our rules about documentation
|
||||
|
||||
:::danger
|
||||
|
||||
We will not document client-only / client related types. If you plan on contributing, make sure the types you want to
|
||||
document can be used by bots and are _intended_ for usage by bots. This is a hard rule that will never change.
|
||||
|
||||
:::
|
||||
|
||||
Not every single update to the API is valid to be documented here. Our main stance for documentation is that properties
|
||||
must be known and documented on [`Discord's API Documentation repository`](https://github.com/discord/discord-api-docs),
|
||||
must be mentioned in an open pull request or must have received the green light to be used.
|
||||
|
||||
With that aside, there are times where documentation for certain types is not approved/merged by Discord on the grounds
|
||||
that `it isn't helpful for bots` (or similar), but it would actually benefit bot developers to have it documented (one
|
||||
good example is the UserFlags `SPAMMER` flag). As such, if you think your update should still be merged, please propose
|
||||
it and we will be handled on a case by case basis. If approved, your update will be documented with an `@unstable` tag.
|
||||
It will also not be subject to the same versioning rules as the rest of the types.
|
||||
|
||||
### Figure out what API versions need to receive the update
|
||||
|
||||
`discord-api-types` has multiple API versions in the repository, some of which may be considered `deprecated` or
|
||||
`discontinued` as we keep them till the version is completely dead before removing them. This is a good time to figure
|
||||
out which API versions need to be updated, and you can use the table below to guide you.
|
||||
|
||||
You can also check [`Discord's API versioning table`](https://discord.com/developers/docs/reference#api-versioning) if
|
||||
you want to be 1000% sure.
|
||||
|
||||
| **API Version** | **Should receive updates** |
|
||||
| :-------------: | :------------------------: |
|
||||
| 10 | Yes |
|
||||
| 9 | Yes |
|
||||
| 8 | No |
|
||||
| 7 | No |
|
||||
| 6 | No |
|
||||
|
||||
If the version you want to contribute to is not listed above (for instance if a new API version rolls out) or if the
|
||||
version you want to contribute to is for a different part of the API (for instance `voice`), feel free to submit it and
|
||||
we will review it accordingly.
|
||||
|
||||
### Figure out where exactly are the files you need to modify to make the update
|
||||
|
||||
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to
|
||||
guide you through it.
|
||||
|
||||
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
|
||||
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
|
||||
files you need to keep in mind when contributing.
|
||||
|
||||
```bash {2,4-6,9-10,12-16}
|
||||
├── deno
|
||||
├── gateway
|
||||
├── node_modules (once you ran `npm ci`)
|
||||
├── payloads
|
||||
├── rest
|
||||
├── rpc
|
||||
├── scripts
|
||||
├── tests
|
||||
├── utils
|
||||
├── voice
|
||||
├── website
|
||||
├── globals.ts
|
||||
├── v6.ts
|
||||
├── v8.ts
|
||||
├── v9.ts
|
||||
├── v10.ts
|
||||
└── package.json
|
||||
```
|
||||
|
||||
#### `deno`
|
||||
|
||||
This folder stores the [`deno`](https://deno.land/) compatible typings for Discord's API.
|
||||
|
||||
:::danger
|
||||
|
||||
This folder should not be manually modified. Any manual changes will be overwritten by the `build:deno` script.
|
||||
|
||||
Any changes that need to be done to this folder need to be done through the `scripts/deno.mjs` file.
|
||||
|
||||
:::
|
||||
|
||||
#### `gateway`
|
||||
|
||||
This folder holds types that are strictly received from
|
||||
[`Discord's gateway`](https://discord.com/developers/docs/topics/gateway). It stores the gateway version the types are
|
||||
for, the intents and opcodes, and any data that can be received/sent through the gateway.
|
||||
|
||||
Each file in the folder represents a gateway version. It references types from the versioned [`payloads`](#payloads)
|
||||
folder unless the payloads come _only_ through the gateway. There is also a `common.ts` file which represents shared
|
||||
types across all versions, as well as an `index.ts` file that exports the recommended gateway version's types.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `Gateway` prefix (for instance `GatewayGuildCreateDispatchData` which is an
|
||||
extension of the `APIGuild` type with extra fields received only through the gateway).
|
||||
|
||||
:::
|
||||
|
||||
#### `payloads`
|
||||
|
||||
This folder holds the bulk of type definitions for Discord's APIs. Each API version receives its own folder. Inside of
|
||||
each folder there is always an `index.ts` file that exports every type available in that version, as well as the common
|
||||
types that can be found in `payloads/common.ts`. At the root of the `payloads` folder is also an `index.ts` file which
|
||||
exports the recommended API version's types.
|
||||
|
||||
Inside of each versioned folder, the files are defined from the structure in
|
||||
[`Discord's API Documentation`](https://discord.dev), under the `Resources` category. Depending on the complexity of the
|
||||
resource, you may opt for splitting it up into multiple files. If you want to do so, please create a folder named
|
||||
`_{resource_name}` where the `resource_name` is the same name as the resource you're splitting up (a good example is the
|
||||
`_interactions` folder which stores all the types for interactions in a neater structure), and create a
|
||||
`{resource_name}.ts` file which exports everything from that folder). If you feel like you need to split it up even
|
||||
more, just repeat the same structure of creating an `_{file_name}` folder and exporting everything from it in the
|
||||
`{file_name}.ts` file (you can see an example
|
||||
[here](https://github.com/discordjs/discord-api-types/tree/85802f1/payloads/v10/_interactions)).
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `API` prefix (for instance `APIUser`), **except** for enums, which should have a
|
||||
normal name (for instance `UserFlags`).
|
||||
|
||||
:::
|
||||
|
||||
#### `rest`
|
||||
|
||||
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
|
||||
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
|
||||
under the `Resources` category.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
|
||||
enums (for instance `Routes`).
|
||||
|
||||
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
|
||||
|
||||
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
|
||||
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
|
||||
- `Query|(JSON|FormData)Body|Result` should be used depending on what the route takes or returns
|
||||
- If a route doesn't take in any parameters, be it query, JSON or FormData, it shouldn't define any of those types
|
||||
- A route should always define a `Result` type, and should reference an `API*` type unless the data returned is only
|
||||
received through a REST call
|
||||
- If a route returns a `204 No Content` response, it should define a `Result` type with `never` as its value (this
|
||||
does not account for errors)
|
||||
|
||||
This structure should be followed whenever possible, however that might not always be doable. Specifically, types for
|
||||
OAuth2 may not follow the structure exactly, but should aim to follow it as much as possible.
|
||||
|
||||
:::
|
||||
|
||||
#### `rpc`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's RPC API`](https://discord.com/developers/docs/topics/rpc). Just like [`gateway`](#gateway), each RPC API
|
||||
version receives its own file.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `RPC` prefix (for instance `RPCErrorCodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `scripts`
|
||||
|
||||
This folder holds the module's scripts that empower our Continuous Integration / Deployment pipelines, as well as other
|
||||
miscellaneous scripts we might need. There's really not much to say about these really...
|
||||
|
||||
#### `tests`
|
||||
|
||||
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
|
||||
unions.
|
||||
|
||||
:::info
|
||||
|
||||
Files created here **must** end in `.test-d.ts`, as otherwise they will not be picked up by
|
||||
[`tsd`](https://www.npmjs.com/package/tsd).
|
||||
|
||||
:::
|
||||
|
||||
#### `utils`
|
||||
|
||||
This folder holds certain utility functions which can be used while working with some complicated types (for instance
|
||||
for more complicated unions). Each API version gets its own file with utility functions, but a folder can be created if
|
||||
a lot of methods are created.
|
||||
|
||||
:::info
|
||||
|
||||
The `internals.ts` file stores types that are strictly used inside the module to help build out our strict types. These
|
||||
types should never be exported from the module.
|
||||
|
||||
:::
|
||||
|
||||
#### `voice`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's Voice API`](https://discord.com/developers/docs/topics/voice-connections). It follows the same folder
|
||||
structure as [`gateway`](#gateway).
|
||||
|
||||
:::info
|
||||
|
||||
Types in this folder must start with the `Voice` prefix (for instance `VoiceOpcodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `website`
|
||||
|
||||
This folder holds...well...this very site you are reading this page from! For the most part, you do not need to alter
|
||||
its contents, except if you're contributing a new API version to the module.
|
||||
|
||||
To add the new version to this very website, edit the `docusaurus.config.js` file, and in the `plugins` array, for the
|
||||
`docusaurus-plugin-typedoc-api` plugin, you need to add an entry similar to the ones already present.
|
||||
|
||||
#### `globals.ts`
|
||||
|
||||
This file stores types that are present regardless of the API version you use.
|
||||
|
||||
#### `v*.ts`
|
||||
|
||||
These files export everything from the previously mentioned folders that match the version the file is named after. It
|
||||
serves as the entry point for importing types from the module (for example by importing `discord-api-types/v10`).
|
||||
|
||||
#### `package.json`
|
||||
|
||||
This is the entry point of the package for [`npm`](https://www.npmjs.com/). You won't need to edit this file unless
|
||||
you're adding a new API version, in which case you should follow the same structure as seen in the `exports` field.
|
||||
@@ -1 +0,0 @@
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.36.3"}]
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.0"}]
|
||||
File diff suppressed because one or more lines are too long
@@ -1,167 +0,0 @@
|
||||
---
|
||||
id: introduction_to_discord-api-types
|
||||
title: Introduction
|
||||
sidebar_position: 0
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="/svgs/logo_long_blurple.svg" className="markdown__logo" />
|
||||
|
||||
[](https://discord-api-types.dev/discord)
|
||||
[](https://www.patreon.com/vladfrangu)
|
||||
[](https://ko-fi.com/wolfgalvlad)
|
||||
[](https://github.com/sponsors/vladfrangu)
|
||||
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://deno.land/x/discord_api_types)
|
||||
|
||||
</div>
|
||||
|
||||
## About
|
||||
|
||||
Discord API Types is a community-maintained project that brings API types for Discord's REST, Gateway and Voice APIs.
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
npm install discord-api-types
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
|
||||
the `*` represents the API version. Below are some examples
|
||||
|
||||
<Tabs groupId="ts2esm2cjs">
|
||||
<TabItem value="javascript" label="JavaScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="esm" label="ESM">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="typescript" label="TypeScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
import { type APIUser } from 'discord-api-types/v10';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
:::info
|
||||
|
||||
You may also import just certain parts of the module that you need. The possible values are: `globals`, `gateway`,
|
||||
`gateway/v*`, `payloads`, `payloads/v*`, `rest`, `rest/v*`, `rpc`, `rpc/v*`, `utils`, `utils/v*`, `voice`, and
|
||||
`voice/v*`. Below is an example of importing directly from the gateway submodule
|
||||
|
||||
```typescript ts2esm2cjs
|
||||
import { GatewayVersion } from 'discord-api-types/gateway/v10';
|
||||
|
||||
console.log(`Let's connect to wss://gateway.discord.gg/?v=${GatewayVersion}`);
|
||||
```
|
||||
|
||||
> _**Note:** The `v*` exports (`discord-api-types/v*`) include the appropriate version of `gateway`, `payloads`, `rest`,
|
||||
> `rpc`, and `utils` you specified, alongside the `globals` exports_
|
||||
|
||||
:::
|
||||
|
||||
### Deno
|
||||
|
||||
We also provide typings compatible with the [deno](https://deno.land/) runtime. Here are 3 examples of how you can
|
||||
import them:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="github" label="From GitHub">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="deno" label="From deno.land/x" default>
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://deno.land/x/discord_api_types/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="skypack" label="From skypack.dev">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v10?dts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Project Structure
|
||||
|
||||
The exports of each API version is split into three main parts:
|
||||
|
||||
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
|
||||
|
||||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the
|
||||
Gateway.
|
||||
|
||||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST
|
||||
API.
|
||||
|
||||
- For endpoint options, they will follow the following structure:
|
||||
`REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
|
||||
|
||||
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
|
||||
|
||||
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of
|
||||
the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
|
||||
|
||||
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
|
||||
|
||||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore
|
||||
it. This does **not** account for errors.
|
||||
|
||||
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route
|
||||
object).
|
||||
|
||||
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the
|
||||
`globals` file. They will still be prefixed accordingly as described above.
|
||||
|
||||
:::danger A note about how types are documented
|
||||
|
||||
This package will add types only for known and documented properties that are present in Discord's
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs), that are mentioned in an open pull request,
|
||||
or known through other means _and have received the green light to be used_. Anything else will not be documented (for
|
||||
example client only types).
|
||||
|
||||
With that aside, we may allow certain types that are not documented in the
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs) on a case by case basis. They will be
|
||||
documented with an `@unstable` tag and are not subject with the same versioning rules.
|
||||
|
||||
:::
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 126 KiB |
@@ -1 +1 @@
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.1"}]
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.11"}]
|
||||
1
website/versioned_docs/version-0.37.11/api-typedoc.json
Normal file
1
website/versioned_docs/version-0.37.11/api-typedoc.json
Normal file
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
@@ -1 +1 @@
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.2"}]
|
||||
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.12"}]
|
||||
1
website/versioned_docs/version-0.37.12/api-typedoc.json
Normal file
1
website/versioned_docs/version-0.37.12/api-typedoc.json
Normal file
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
@@ -1,263 +0,0 @@
|
||||
---
|
||||
id: contributing_to_discord-api-types
|
||||
title: How to Contribute
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
So, you'd like to contribute to `discord-api-types` but don't know where to start or what to do? Here are some of the
|
||||
things you need to keep in mind before opening a pull request!
|
||||
|
||||
:::tip Before you begin
|
||||
|
||||
We recommend you contribute either through locally editing the files on your desktop (which means also installing
|
||||
[`npm`](https://www.npmjs.com/) dependencies as this will ensure not only a consistent code style, but also that the
|
||||
`deno` types stay in sync automatically) or through a service like
|
||||
[`GitHub Codespaces`](https://github.com/features/codespaces).
|
||||
|
||||
:::
|
||||
|
||||
:::info Still can't figure it out?
|
||||
|
||||
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the `#developing-djs`
|
||||
channel.
|
||||
|
||||
:::
|
||||
|
||||
### Install npm dependencies first
|
||||
|
||||
One of the most crucial steps is installing [`npm`](https://www.npmjs.com/) dependencies via `npm ci`. This ensures that
|
||||
linting can be done, and it also sets up the `git` hooks for building the `deno` types and automatically
|
||||
formatting/linting the code when you commit it.
|
||||
|
||||
If you forget to install [`npm`](https://www.npmjs.com/) dependencies, or are doing the contributions through other
|
||||
means (like directly from GitHub web), you might see a comment like this one being sent as a review to your pull
|
||||
request:
|
||||
|
||||

|
||||
|
||||
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
|
||||
|
||||
### Figure out if the update you want to contribute respects our rules about documentation
|
||||
|
||||
:::danger
|
||||
|
||||
We will not document client-only / client related types. If you plan on contributing, make sure the types you want to
|
||||
document can be used by bots and are _intended_ for usage by bots. This is a hard rule that will never change.
|
||||
|
||||
:::
|
||||
|
||||
Not every single update to the API is valid to be documented here. Our main stance for documentation is that properties
|
||||
must be known and documented on [`Discord's API Documentation repository`](https://github.com/discord/discord-api-docs),
|
||||
must be mentioned in an open pull request or must have received the green light to be used.
|
||||
|
||||
With that aside, there are times where documentation for certain types is not approved/merged by Discord on the grounds
|
||||
that `it isn't helpful for bots` (or similar), but it would actually benefit bot developers to have it documented (one
|
||||
good example is the UserFlags `SPAMMER` flag). As such, if you think your update should still be merged, please propose
|
||||
it and we will be handled on a case by case basis. If approved, your update will be documented with an `@unstable` tag.
|
||||
It will also not be subject to the same versioning rules as the rest of the types.
|
||||
|
||||
### Figure out what API versions need to receive the update
|
||||
|
||||
`discord-api-types` has multiple API versions in the repository, some of which may be considered `deprecated` or
|
||||
`discontinued` as we keep them till the version is completely dead before removing them. This is a good time to figure
|
||||
out which API versions need to be updated, and you can use the table below to guide you.
|
||||
|
||||
You can also check [`Discord's API versioning table`](https://discord.com/developers/docs/reference#api-versioning) if
|
||||
you want to be 1000% sure.
|
||||
|
||||
| **API Version** | **Should receive updates** |
|
||||
| :-------------: | :------------------------: |
|
||||
| 10 | Yes |
|
||||
| 9 | Yes |
|
||||
| 8 | No |
|
||||
| 7 | No |
|
||||
| 6 | No |
|
||||
|
||||
If the version you want to contribute to is not listed above (for instance if a new API version rolls out) or if the
|
||||
version you want to contribute to is for a different part of the API (for instance `voice`), feel free to submit it and
|
||||
we will review it accordingly.
|
||||
|
||||
### Figure out where exactly are the files you need to modify to make the update
|
||||
|
||||
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to
|
||||
guide you through it.
|
||||
|
||||
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
|
||||
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
|
||||
files you need to keep in mind when contributing.
|
||||
|
||||
```bash {2,4-6,9-10,12-16}
|
||||
├── deno
|
||||
├── gateway
|
||||
├── node_modules (once you ran `npm ci`)
|
||||
├── payloads
|
||||
├── rest
|
||||
├── rpc
|
||||
├── scripts
|
||||
├── tests
|
||||
├── utils
|
||||
├── voice
|
||||
├── website
|
||||
├── globals.ts
|
||||
├── v6.ts
|
||||
├── v8.ts
|
||||
├── v9.ts
|
||||
├── v10.ts
|
||||
└── package.json
|
||||
```
|
||||
|
||||
#### `deno`
|
||||
|
||||
This folder stores the [`deno`](https://deno.land/) compatible typings for Discord's API.
|
||||
|
||||
:::danger
|
||||
|
||||
This folder should not be manually modified. Any manual changes will be overwritten by the `build:deno` script.
|
||||
|
||||
Any changes that need to be done to this folder need to be done through the `scripts/deno.mjs` file.
|
||||
|
||||
:::
|
||||
|
||||
#### `gateway`
|
||||
|
||||
This folder holds types that are strictly received from
|
||||
[`Discord's gateway`](https://discord.com/developers/docs/topics/gateway). It stores the gateway version the types are
|
||||
for, the intents and opcodes, and any data that can be received/sent through the gateway.
|
||||
|
||||
Each file in the folder represents a gateway version. It references types from the versioned [`payloads`](#payloads)
|
||||
folder unless the payloads come _only_ through the gateway. There is also a `common.ts` file which represents shared
|
||||
types across all versions, as well as an `index.ts` file that exports the recommended gateway version's types.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `Gateway` prefix (for instance `GatewayGuildCreateDispatchData` which is an
|
||||
extension of the `APIGuild` type with extra fields received only through the gateway).
|
||||
|
||||
:::
|
||||
|
||||
#### `payloads`
|
||||
|
||||
This folder holds the bulk of type definitions for Discord's APIs. Each API version receives its own folder. Inside of
|
||||
each folder there is always an `index.ts` file that exports every type available in that version, as well as the common
|
||||
types that can be found in `payloads/common.ts`. At the root of the `payloads` folder is also an `index.ts` file which
|
||||
exports the recommended API version's types.
|
||||
|
||||
Inside of each versioned folder, the files are defined from the structure in
|
||||
[`Discord's API Documentation`](https://discord.dev), under the `Resources` category. Depending on the complexity of the
|
||||
resource, you may opt for splitting it up into multiple files. If you want to do so, please create a folder named
|
||||
`_{resource_name}` where the `resource_name` is the same name as the resource you're splitting up (a good example is the
|
||||
`_interactions` folder which stores all the types for interactions in a neater structure), and create a
|
||||
`{resource_name}.ts` file which exports everything from that folder). If you feel like you need to split it up even
|
||||
more, just repeat the same structure of creating an `_{file_name}` folder and exporting everything from it in the
|
||||
`{file_name}.ts` file (you can see an example
|
||||
[here](https://github.com/discordjs/discord-api-types/tree/85802f1/payloads/v10/_interactions)).
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `API` prefix (for instance `APIUser`), **except** for enums, which should have a
|
||||
normal name (for instance `UserFlags`).
|
||||
|
||||
:::
|
||||
|
||||
#### `rest`
|
||||
|
||||
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
|
||||
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
|
||||
under the `Resources` category.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
|
||||
enums (for instance `Routes`).
|
||||
|
||||
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
|
||||
|
||||
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
|
||||
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
|
||||
- `Query|(JSON|FormData)Body|Result` should be used depending on what the route takes or returns
|
||||
- If a route doesn't take in any parameters, be it query, JSON or FormData, it shouldn't define any of those types
|
||||
- A route should always define a `Result` type, and should reference an `API*` type unless the data returned is only
|
||||
received through a REST call
|
||||
- If a route returns a `204 No Content` response, it should define a `Result` type with `never` as its value (this
|
||||
does not account for errors)
|
||||
|
||||
This structure should be followed whenever possible, however that might not always be doable. Specifically, types for
|
||||
OAuth2 may not follow the structure exactly, but should aim to follow it as much as possible.
|
||||
|
||||
:::
|
||||
|
||||
#### `rpc`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's RPC API`](https://discord.com/developers/docs/topics/rpc). Just like [`gateway`](#gateway), each RPC API
|
||||
version receives its own file.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `RPC` prefix (for instance `RPCErrorCodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `scripts`
|
||||
|
||||
This folder holds the module's scripts that empower our Continuous Integration / Deployment pipelines, as well as other
|
||||
miscellaneous scripts we might need. There's really not much to say about these really...
|
||||
|
||||
#### `tests`
|
||||
|
||||
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
|
||||
unions.
|
||||
|
||||
:::info
|
||||
|
||||
Files created here **must** end in `.test-d.ts`, as otherwise they will not be picked up by
|
||||
[`tsd`](https://www.npmjs.com/package/tsd).
|
||||
|
||||
:::
|
||||
|
||||
#### `utils`
|
||||
|
||||
This folder holds certain utility functions which can be used while working with some complicated types (for instance
|
||||
for more complicated unions). Each API version gets its own file with utility functions, but a folder can be created if
|
||||
a lot of methods are created.
|
||||
|
||||
:::info
|
||||
|
||||
The `internals.ts` file stores types that are strictly used inside the module to help build out our strict types. These
|
||||
types should never be exported from the module.
|
||||
|
||||
:::
|
||||
|
||||
#### `voice`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's Voice API`](https://discord.com/developers/docs/topics/voice-connections). It follows the same folder
|
||||
structure as [`gateway`](#gateway).
|
||||
|
||||
:::info
|
||||
|
||||
Types in this folder must start with the `Voice` prefix (for instance `VoiceOpcodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `website`
|
||||
|
||||
This folder holds...well...this very site you are reading this page from! For the most part, you do not need to alter
|
||||
its contents, except if you're contributing a new API version to the module.
|
||||
|
||||
To add the new version to this very website, edit the `docusaurus.config.js` file, and in the `plugins` array, for the
|
||||
`docusaurus-plugin-typedoc-api` plugin, you need to add an entry similar to the ones already present.
|
||||
|
||||
#### `globals.ts`
|
||||
|
||||
This file stores types that are present regardless of the API version you use.
|
||||
|
||||
#### `v*.ts`
|
||||
|
||||
These files export everything from the previously mentioned folders that match the version the file is named after. It
|
||||
serves as the entry point for importing types from the module (for example by importing `discord-api-types/v10`).
|
||||
|
||||
#### `package.json`
|
||||
|
||||
This is the entry point of the package for [`npm`](https://www.npmjs.com/). You won't need to edit this file unless
|
||||
you're adding a new API version, in which case you should follow the same structure as seen in the `exports` field.
|
||||
@@ -1,167 +0,0 @@
|
||||
---
|
||||
id: introduction_to_discord-api-types
|
||||
title: Introduction
|
||||
sidebar_position: 0
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="/svgs/logo_long_blurple.svg" className="markdown__logo" />
|
||||
|
||||
[](https://discord-api-types.dev/discord)
|
||||
[](https://www.patreon.com/vladfrangu)
|
||||
[](https://ko-fi.com/wolfgalvlad)
|
||||
[](https://github.com/sponsors/vladfrangu)
|
||||
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://deno.land/x/discord_api_types)
|
||||
|
||||
</div>
|
||||
|
||||
## About
|
||||
|
||||
Discord API Types is a community-maintained project that brings API types for Discord's REST, Gateway and Voice APIs.
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
npm install discord-api-types
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
|
||||
the `*` represents the API version. Below are some examples
|
||||
|
||||
<Tabs groupId="ts2esm2cjs">
|
||||
<TabItem value="javascript" label="JavaScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="esm" label="ESM">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="typescript" label="TypeScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
import { type APIUser } from 'discord-api-types/v10';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
:::info
|
||||
|
||||
You may also import just certain parts of the module that you need. The possible values are: `globals`, `gateway`,
|
||||
`gateway/v*`, `payloads`, `payloads/v*`, `rest`, `rest/v*`, `rpc`, `rpc/v*`, `utils`, `utils/v*`, `voice`, and
|
||||
`voice/v*`. Below is an example of importing directly from the gateway submodule
|
||||
|
||||
```typescript ts2esm2cjs
|
||||
import { GatewayVersion } from 'discord-api-types/gateway/v10';
|
||||
|
||||
console.log(`Let's connect to wss://gateway.discord.gg/?v=${GatewayVersion}`);
|
||||
```
|
||||
|
||||
> _**Note:** The `v*` exports (`discord-api-types/v*`) include the appropriate version of `gateway`, `payloads`, `rest`,
|
||||
> `rpc`, and `utils` you specified, alongside the `globals` exports_
|
||||
|
||||
:::
|
||||
|
||||
### Deno
|
||||
|
||||
We also provide typings compatible with the [deno](https://deno.land/) runtime. Here are 3 examples of how you can
|
||||
import them:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="github" label="From GitHub">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="deno" label="From deno.land/x" default>
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://deno.land/x/discord_api_types/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="skypack" label="From skypack.dev">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v10?dts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Project Structure
|
||||
|
||||
The exports of each API version is split into three main parts:
|
||||
|
||||
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
|
||||
|
||||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the
|
||||
Gateway.
|
||||
|
||||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST
|
||||
API.
|
||||
|
||||
- For endpoint options, they will follow the following structure:
|
||||
`REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
|
||||
|
||||
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
|
||||
|
||||
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of
|
||||
the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
|
||||
|
||||
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
|
||||
|
||||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore
|
||||
it. This does **not** account for errors.
|
||||
|
||||
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route
|
||||
object).
|
||||
|
||||
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the
|
||||
`globals` file. They will still be prefixed accordingly as described above.
|
||||
|
||||
:::danger A note about how types are documented
|
||||
|
||||
This package will add types only for known and documented properties that are present in Discord's
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs), that are mentioned in an open pull request,
|
||||
or known through other means _and have received the green light to be used_. Anything else will not be documented (for
|
||||
example client only types).
|
||||
|
||||
With that aside, we may allow certain types that are not documented in the
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs) on a case by case basis. They will be
|
||||
documented with an `@unstable` tag and are not subject with the same versioning rules.
|
||||
|
||||
:::
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 126 KiB |
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"sidebar": [
|
||||
{
|
||||
"type": "autogenerated",
|
||||
"dirName": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"sidebar": [
|
||||
{
|
||||
"type": "autogenerated",
|
||||
"dirName": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
[
|
||||
"0.37.2",
|
||||
"0.37.1",
|
||||
"0.37.0",
|
||||
"0.36.3"
|
||||
"0.37.12",
|
||||
"0.37.11"
|
||||
]
|
||||
Reference in New Issue
Block a user