Compare commits

...

11 Commits

Author SHA1 Message Date
Vlad Frangu
5723cc04bf chore(release): 0.22.0 🎉 (#177) 2021-08-01 00:51:03 +03:00
Vlad Frangu
f93b6be252 chore(ApplicationCommandOptionType): casing changes for subcommands (#175)
BREAKING CHANGE: This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
2021-08-01 00:48:14 +03:00
Vlad Frangu
b75b05f0d5 fix(MessageComponent): correct type for emoji (#176) 2021-08-01 00:47:15 +03:00
Advaith
47100bcf2c feat: thread updates (#167)
* feat: thread updates

* feat: update Routes

BREAKING CHANGE: `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
2021-07-31 23:54:06 +03:00
ckohen
a93235c9df fix(Gateway): thread list sync now sends an array as documented (#174)
BREAKING CHANGE: `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
2021-07-31 23:52:27 +03:00
Vlad Frangu
b1589545e9 chore(release): 0.21.0 🎉 (#173) 2021-07-31 02:14:54 +03:00
Vlad Frangu
647905e16b revert: fix: change resolved index types to string (#172)
This reverts commit d338409410.
2021-07-31 02:10:57 +03:00
Noel
f2995073e0 feat(Globals): revert template bigint type to string type (#171)
BREAKING CHANGE: The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
2021-07-31 02:05:50 +03:00
Advaith
6f15e537df feat(ApplicationCommandOptionType): add Number (10) (#153) 2021-07-26 22:12:54 +03:00
Advaith
d338409410 fix: change resolved index types to string (#169) 2021-07-26 22:12:35 +03:00
Advaith
ef2a0aeb07 fix: export APIPingInteraction (#168) 2021-07-26 08:49:31 +03:00
28 changed files with 379 additions and 53 deletions

View File

@@ -1,3 +1,45 @@
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes

View File

@@ -1,3 +1,45 @@
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes

View File

@@ -1,13 +1,13 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
export type Snowflake = string;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
export type Permissions = string;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats

View File

@@ -68,7 +68,7 @@ export type APIApplicationCommandOption =
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.SubCommand | ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
@@ -79,7 +79,10 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer;
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
@@ -87,8 +90,8 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
@@ -96,6 +99,7 @@ export enum ApplicationCommandOptionType {
Channel,
Role,
Mentionable,
Number,
}
/**
@@ -145,13 +149,13 @@ export type APIApplicationCommandInteractionDataOption =
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
@@ -162,6 +166,7 @@ export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
@@ -194,6 +199,11 @@ export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOpti
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean

View File

@@ -955,13 +955,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1047,7 +1062,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

View File

@@ -12,6 +12,7 @@ import type {
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';

View File

@@ -68,7 +68,7 @@ export type APIApplicationCommandOption =
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.SubCommand | ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
@@ -79,7 +79,10 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer;
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
@@ -87,8 +90,8 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
@@ -96,6 +99,7 @@ export enum ApplicationCommandOptionType {
Channel,
Role,
Mentionable,
Number,
}
/**
@@ -145,13 +149,13 @@ export type APIApplicationCommandInteractionDataOption =
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
@@ -162,6 +166,7 @@ export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
@@ -194,6 +199,11 @@ export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOpti
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite } from './channel.ts';
import type { APIChannel, APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -46,6 +46,14 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* Threads found in the audit log
*
* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map, since archived threads might not be kept in memory by clients.
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
}
/**
@@ -144,6 +152,10 @@ export enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
ThreadCreate = 110,
ThreadUpdate,
ThreadDelete,
}
/**
@@ -302,7 +314,11 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyArchived
| APIAuditLogChangeKeyLocked
| APIAuditLogChangeKeyAutoArchiveDuration
| APIAuditLogChangeKeyDefaultAutoArchiveDuration;
/**
* Returned when an entity's name is changed
@@ -611,6 +627,29 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/*
* Returned when a thread's archive status is changed
*/
export type APIAuditLogChangeKeyArchived = AuditLogChangeData<'archived', boolean>;
/*
* Returned when a thread's lock status is changed
*/
export type APIAuditLogChangeKeyLocked = AuditLogChangeData<'locked', boolean>;
/*
* Returned when a thread's auto archive duration is changed
*/
export type APIAuditLogChangeKeyAutoArchiveDuration = AuditLogChangeData<'auto_archive_duration', number>;
/*
* Returned when a channel's default auto archive duration for newly created threads is changed
*/
export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
'default_auto_archive_duration',
number
>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -72,6 +72,11 @@ export interface APIChannel extends APIPartialChannel {
/**
* Amount of seconds a user has to wait before sending another message (0-21600);
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected
*
* `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval.
*
* For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value.
* The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value.
*/
rate_limit_per_user?: number;
/**
@@ -1075,13 +1080,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1167,7 +1187,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

View File

@@ -331,11 +331,9 @@ export interface GatewayThreadListSync {
/**
* The member objects for the client user in each joined thread that was synced
*/
members: Record<Snowflake, GatewayThreadListSyncMember>;
members: APIThreadMember[];
}
export type GatewayThreadListSyncMember = Omit<APIThreadMember, 'id' | 'user_id'>;
/**
* https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields
*/

View File

@@ -12,6 +12,7 @@ import type {
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';

View File

@@ -577,6 +577,8 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
name: string;
/**
* The amount of time in minutes to wait before automatically archiving the thread
*
* The 3 day and 7 day archive durations require the server to be boosted. The [guild features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) will indicate if a server is able to use those settings.
*/
auto_archive_duration: ThreadAutoArchiveDuration;
}
@@ -592,8 +594,15 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
}
/**
@@ -632,6 +641,8 @@ export interface RESTGetAPIChannelThreadsArchivedQuery {
/**
* https://discord.com/developers/docs/resources/channel#list-active-threads
*
* @deprecated Use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead. Will be removed in v10.
*/
export type RESTGetAPIChannelThreadsResult = APIThreadList;

View File

@@ -12,6 +12,7 @@ import type {
APIGuildWidget,
APIGuildWidgetSettings,
APIRole,
APIThreadList,
APIVoiceRegion,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
@@ -303,6 +304,11 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
*/
export type RESTPatchAPIGuildChannelPositionsResult = never;
/**
* https://discord.com/developers/docs/resources/guild#list-active-threads
*/
export type RESTGetAPIGuildThreadsResult = Omit<APIThreadList, 'has_more'>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-member
*/

View File

@@ -435,9 +435,19 @@ export const Routes = {
return parts.join('/') as `/channels/${Snowflake}/threads` | `/channels/${Snowflake}/messages/${Snowflake}/threads`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/threads/active`
*/
guildActiveThreads(guildId: Snowflake) {
return `/guilds/${guildId}/threads/active` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/threads/active`
* (deprecated, use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead.
* Will be removed in v10.)
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
@@ -456,7 +466,7 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
*/
channelJoinedArhivedThreads(channelId: Snowflake) {
channelJoinedArchivedThreads(channelId: Snowflake) {
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
},

View File

@@ -1,13 +1,13 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
export type Snowflake = string;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
export type Permissions = string;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats

4
package-lock.json generated
View File

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

View File

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

View File

@@ -68,7 +68,7 @@ export type APIApplicationCommandOption =
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.SubCommand | ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
@@ -79,7 +79,10 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer;
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
@@ -87,8 +90,8 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
@@ -96,6 +99,7 @@ export const enum ApplicationCommandOptionType {
Channel,
Role,
Mentionable,
Number,
}
/**
@@ -145,13 +149,13 @@ export type APIApplicationCommandInteractionDataOption =
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
@@ -162,6 +166,7 @@ export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
@@ -194,6 +199,11 @@ export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOpti
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean

View File

@@ -955,13 +955,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1047,7 +1062,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

View File

@@ -12,6 +12,7 @@ import type {
export * from './_interactions/base';
export * from './_interactions/messageComponents';
export * from './_interactions/ping';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';

View File

@@ -68,7 +68,7 @@ export type APIApplicationCommandOption =
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.SubCommand | ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
@@ -79,7 +79,10 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer;
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
@@ -87,8 +90,8 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
@@ -96,6 +99,7 @@ export const enum ApplicationCommandOptionType {
Channel,
Role,
Mentionable,
Number,
}
/**
@@ -145,13 +149,13 @@ export type APIApplicationCommandInteractionDataOption =
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
@@ -162,6 +166,7 @@ export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
@@ -194,6 +199,11 @@ export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOpti
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals';
import type { APIOverwrite } from './channel';
import type { APIChannel, APIOverwrite } from './channel';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -46,6 +46,14 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* Threads found in the audit log
*
* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map, since archived threads might not be kept in memory by clients.
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
}
/**
@@ -144,6 +152,10 @@ export const enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
ThreadCreate = 110,
ThreadUpdate,
ThreadDelete,
}
/**
@@ -302,7 +314,11 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyArchived
| APIAuditLogChangeKeyLocked
| APIAuditLogChangeKeyAutoArchiveDuration
| APIAuditLogChangeKeyDefaultAutoArchiveDuration;
/**
* Returned when an entity's name is changed
@@ -611,6 +627,29 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/*
* Returned when a thread's archive status is changed
*/
export type APIAuditLogChangeKeyArchived = AuditLogChangeData<'archived', boolean>;
/*
* Returned when a thread's lock status is changed
*/
export type APIAuditLogChangeKeyLocked = AuditLogChangeData<'locked', boolean>;
/*
* Returned when a thread's auto archive duration is changed
*/
export type APIAuditLogChangeKeyAutoArchiveDuration = AuditLogChangeData<'auto_archive_duration', number>;
/*
* Returned when a channel's default auto archive duration for newly created threads is changed
*/
export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
'default_auto_archive_duration',
number
>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -72,6 +72,11 @@ export interface APIChannel extends APIPartialChannel {
/**
* Amount of seconds a user has to wait before sending another message (0-21600);
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected
*
* `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval.
*
* For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value.
* The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value.
*/
rate_limit_per_user?: number;
/**
@@ -1075,13 +1080,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1167,7 +1187,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

View File

@@ -331,11 +331,9 @@ export interface GatewayThreadListSync {
/**
* The member objects for the client user in each joined thread that was synced
*/
members: Record<Snowflake, GatewayThreadListSyncMember>;
members: APIThreadMember[];
}
export type GatewayThreadListSyncMember = Omit<APIThreadMember, 'id' | 'user_id'>;
/**
* https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields
*/

View File

@@ -12,6 +12,7 @@ import type {
export * from './_interactions/base';
export * from './_interactions/messageComponents';
export * from './_interactions/ping';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';

View File

@@ -577,6 +577,8 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
name: string;
/**
* The amount of time in minutes to wait before automatically archiving the thread
*
* The 3 day and 7 day archive durations require the server to be boosted. The [guild features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) will indicate if a server is able to use those settings.
*/
auto_archive_duration: ThreadAutoArchiveDuration;
}
@@ -592,8 +594,15 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
}
/**
@@ -632,6 +641,8 @@ export interface RESTGetAPIChannelThreadsArchivedQuery {
/**
* https://discord.com/developers/docs/resources/channel#list-active-threads
*
* @deprecated Use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead. Will be removed in v10.
*/
export type RESTGetAPIChannelThreadsResult = APIThreadList;

View File

@@ -12,6 +12,7 @@ import type {
APIGuildWidget,
APIGuildWidgetSettings,
APIRole,
APIThreadList,
APIVoiceRegion,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
@@ -303,6 +304,11 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
*/
export type RESTPatchAPIGuildChannelPositionsResult = never;
/**
* https://discord.com/developers/docs/resources/guild#list-active-threads
*/
export type RESTGetAPIGuildThreadsResult = Omit<APIThreadList, 'has_more'>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-member
*/

View File

@@ -435,9 +435,19 @@ export const Routes = {
return parts.join('/') as `/channels/${Snowflake}/threads` | `/channels/${Snowflake}/messages/${Snowflake}/threads`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/threads/active`
*/
guildActiveThreads(guildId: Snowflake) {
return `/guilds/${guildId}/threads/active` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/threads/active`
* (deprecated, use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead.
* Will be removed in v10.)
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
@@ -456,7 +466,7 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
*/
channelJoinedArhivedThreads(channelId: Snowflake) {
channelJoinedArchivedThreads(channelId: Snowflake) {
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
},