mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-29 14:50:08 +00:00
feat: thread updates (#167)
* feat: thread updates * feat: update Routes BREAKING CHANGE: `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
This commit is contained in:
@@ -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;
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user