diff --git a/.vscode/settings.json b/.vscode/settings.json index 76b60054..9ff116af 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { - "files.eol": "\n", - "typescript.tsdk": "node_modules/typescript/lib" + "files.eol": "\n", + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/deno/gateway/v8.ts b/deno/gateway/v8.ts index 2a81d3bb..3050e7c5 100644 --- a/deno/gateway/v8.ts +++ b/deno/gateway/v8.ts @@ -15,6 +15,7 @@ import type { APIMessage, APIMessageComponentInteraction, APIRole, + APIStageInstance, APIUnavailableGuild, APIUser, GatewayActivity, @@ -223,6 +224,9 @@ export enum GatewayDispatchEvents { MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI', MessageUpdate = 'MESSAGE_UPDATE', PresenceUpdate = 'PRESENCE_UPDATE', + StageInstanceCreate = 'STAGE_INSTANCE_CREATE', + StageInstanceDelete = 'STAGE_INSTANCE_DELETE', + StageInstanceUpdate = 'STAGE_INSTANCE_UPDATE', Ready = 'READY', Resumed = 'RESUMED', TypingStart = 'TYPING_START', @@ -277,6 +281,9 @@ export type GatewayDispatchPayload = | GatewayMessageReactionRemoveEmojiDispatch | GatewayMessageUpdateDispatch | GatewayPresenceUpdateDispatch + | GatewayStageInstanceCreateDispatch + | GatewayStageInstanceDeleteDispatch + | GatewayStageInstanceUpdateDispatch | GatewayReadyDispatch | GatewayResumedDispatch | GatewayTypingStartDispatch @@ -1135,6 +1142,45 @@ export type GatewayPresenceUpdateDispatch = DataPayload< */ export type GatewayPresenceUpdateDispatchData = RawGatewayPresenceUpdate; +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceCreate, + GatewayStageInstanceCreateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceDelete, + GatewayStageInstanceDeleteDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceUpdate, + GatewayStageInstanceUpdateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatchData = APIStageInstance; + /** * https://discord.com/developers/docs/topics/gateway#typing-start */ diff --git a/deno/gateway/v9.ts b/deno/gateway/v9.ts index 49062285..2cdcfc7a 100644 --- a/deno/gateway/v9.ts +++ b/deno/gateway/v9.ts @@ -15,6 +15,7 @@ import type { APIMessage, APIMessageComponentInteraction, APIRole, + APIStageInstance, APIThreadMember, APIUnavailableGuild, APIUser, @@ -226,6 +227,9 @@ export enum GatewayDispatchEvents { MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI', MessageUpdate = 'MESSAGE_UPDATE', PresenceUpdate = 'PRESENCE_UPDATE', + StageInstanceCreate = 'STAGE_INSTANCE_CREATE', + StageInstanceDelete = 'STAGE_INSTANCE_DELETE', + StageInstanceUpdate = 'STAGE_INSTANCE_UPDATE', Ready = 'READY', Resumed = 'RESUMED', ThreadCreate = 'THREAD_CREATE', @@ -1148,6 +1152,45 @@ export type GatewayPresenceUpdateDispatch = DataPayload< */ export type GatewayPresenceUpdateDispatchData = RawGatewayPresenceUpdate; +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceCreate, + GatewayStageInstanceCreateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceDelete, + GatewayStageInstanceDeleteDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceUpdate, + GatewayStageInstanceUpdateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatchData = APIStageInstance; + /** * https://discord.com/developers/docs/topics/gateway#thread-list-sync */ diff --git a/deno/payloads/v8/guild.ts b/deno/payloads/v8/guild.ts index 518d9f5a..813b0856 100644 --- a/deno/payloads/v8/guild.ts +++ b/deno/payloads/v8/guild.ts @@ -7,6 +7,7 @@ import type { APIChannel } from './channel.ts'; import type { APIEmoji } from './emoji.ts'; import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway.ts'; import type { APIRole } from './permissions.ts'; +import type { APIStageInstance } from './stageInstance.ts'; import type { APIUser } from './user.ts'; import type { GatewayVoiceState } from './voice.ts'; @@ -309,6 +310,14 @@ export interface APIGuild extends APIPartialGuild { * See https://support.discord.com/hc/en-us/articles/1500005389362-NSFW-Server-Designation */ nsfw: boolean; + /** + * The stage instances in the guild + * + * **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event** + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure + */ + stage_instances?: APIStageInstance[]; } /** diff --git a/deno/payloads/v8/invite.ts b/deno/payloads/v8/invite.ts index 95a4177c..9a939ecb 100644 --- a/deno/payloads/v8/invite.ts +++ b/deno/payloads/v8/invite.ts @@ -5,6 +5,7 @@ import type { APIPartialChannel } from './channel.ts'; import type { APIPartialGuild } from './guild.ts'; import type { APIApplication } from './oauth2.ts'; +import type { APIInviteStageInstance } from './stageInstance.ts'; import type { APIUser } from './user.ts'; /** @@ -63,6 +64,10 @@ export interface APIInvite { * The expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true` */ expires_at?: string | null; + /** + * The stage instance data if there is a public stage instance in the stage channel this invite is for + */ + stage_instance?: APIInviteStageInstance; } /** diff --git a/deno/payloads/v8/mod.ts b/deno/payloads/v8/mod.ts index f512c8bf..7c98277c 100644 --- a/deno/payloads/v8/mod.ts +++ b/deno/payloads/v8/mod.ts @@ -7,6 +7,7 @@ export * from './interactions.ts'; export * from './invite.ts'; export * from './oauth2.ts'; export * from './permissions.ts'; +export * from './stageInstance.ts'; export * from './teams.ts'; export * from './template.ts'; export * from './user.ts'; diff --git a/deno/payloads/v8/stageInstance.ts b/deno/payloads/v8/stageInstance.ts new file mode 100644 index 00000000..971983ed --- /dev/null +++ b/deno/payloads/v8/stageInstance.ts @@ -0,0 +1,72 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIGuildMember } from './guild.ts'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object + */ +export interface APIStageInstance { + /** + * The id of the stage instance + */ + id: Snowflake; + /** + * The guild id of the associated stage channel + */ + guild_id: Snowflake; + /** + * The id of the associated stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ + privacy_level: StageInstancePrivacyLevel; + /** + * Whether or not stage discovery is disabled + */ + discoverable_disabled: boolean; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ +export enum StageInstancePrivacyLevel { + /** + * The stage instance is visible publicly, such as on stage discovery + */ + Public = 1, + /** + * The stage instance is visible to only guild members + */ + GuildOnly, +} + +/** + * https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure + */ +export interface APIInviteStageInstance { + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The number of users in the stage + */ + participant_count: number; + /** + * The number of users speaking in the stage + */ + speaker_count: number; + /** + * The members speaking in the stage + * + * See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure + */ + members: APIGuildMember[]; +} diff --git a/deno/payloads/v9/guild.ts b/deno/payloads/v9/guild.ts index 0546a48e..dbacf5e0 100644 --- a/deno/payloads/v9/guild.ts +++ b/deno/payloads/v9/guild.ts @@ -7,6 +7,7 @@ import type { APIChannel } from './channel.ts'; import type { APIEmoji } from './emoji.ts'; import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway.ts'; import type { APIRole } from './permissions.ts'; +import type { APIStageInstance } from './stageInstance.ts'; import type { APIUser } from './user.ts'; import type { GatewayVoiceState } from './voice.ts'; @@ -317,6 +318,14 @@ export interface APIGuild extends APIPartialGuild { * See https://support.discord.com/hc/en-us/articles/1500005389362-NSFW-Server-Designation */ nsfw: boolean; + /** + * The stage instances in the guild + * + * **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event** + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure + */ + stage_instances?: APIStageInstance[]; } /** diff --git a/deno/payloads/v9/invite.ts b/deno/payloads/v9/invite.ts index 95a4177c..9a939ecb 100644 --- a/deno/payloads/v9/invite.ts +++ b/deno/payloads/v9/invite.ts @@ -5,6 +5,7 @@ import type { APIPartialChannel } from './channel.ts'; import type { APIPartialGuild } from './guild.ts'; import type { APIApplication } from './oauth2.ts'; +import type { APIInviteStageInstance } from './stageInstance.ts'; import type { APIUser } from './user.ts'; /** @@ -63,6 +64,10 @@ export interface APIInvite { * The expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true` */ expires_at?: string | null; + /** + * The stage instance data if there is a public stage instance in the stage channel this invite is for + */ + stage_instance?: APIInviteStageInstance; } /** diff --git a/deno/payloads/v9/mod.ts b/deno/payloads/v9/mod.ts index f512c8bf..7c98277c 100644 --- a/deno/payloads/v9/mod.ts +++ b/deno/payloads/v9/mod.ts @@ -7,6 +7,7 @@ export * from './interactions.ts'; export * from './invite.ts'; export * from './oauth2.ts'; export * from './permissions.ts'; +export * from './stageInstance.ts'; export * from './teams.ts'; export * from './template.ts'; export * from './user.ts'; diff --git a/deno/payloads/v9/stageInstance.ts b/deno/payloads/v9/stageInstance.ts new file mode 100644 index 00000000..971983ed --- /dev/null +++ b/deno/payloads/v9/stageInstance.ts @@ -0,0 +1,72 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIGuildMember } from './guild.ts'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object + */ +export interface APIStageInstance { + /** + * The id of the stage instance + */ + id: Snowflake; + /** + * The guild id of the associated stage channel + */ + guild_id: Snowflake; + /** + * The id of the associated stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ + privacy_level: StageInstancePrivacyLevel; + /** + * Whether or not stage discovery is disabled + */ + discoverable_disabled: boolean; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ +export enum StageInstancePrivacyLevel { + /** + * The stage instance is visible publicly, such as on stage discovery + */ + Public = 1, + /** + * The stage instance is visible to only guild members + */ + GuildOnly, +} + +/** + * https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure + */ +export interface APIInviteStageInstance { + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The number of users in the stage + */ + participant_count: number; + /** + * The number of users speaking in the stage + */ + speaker_count: number; + /** + * The members speaking in the stage + * + * See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure + */ + members: APIGuildMember[]; +} diff --git a/deno/rest/v8/mod.ts b/deno/rest/v8/mod.ts index 12b4e162..deeb314f 100644 --- a/deno/rest/v8/mod.ts +++ b/deno/rest/v8/mod.ts @@ -10,6 +10,7 @@ export * from './guild.ts'; export * from './interactions.ts'; export * from './invite.ts'; export * from './oauth2.ts'; +export * from './stageInstance.ts'; export * from './template.ts'; export * from './user.ts'; export * from './voice.ts'; @@ -659,6 +660,24 @@ export const Routes = { guildWelcomeScreen(guildID: Snowflake) { return `/guilds/${guildID}/welcome-screen` as const; }, + + /** + * Route for: + * - POST `/stage-instances` + */ + stageInstances() { + return `/stage-instances` as const; + }, + + /** + * Route for: + * - GET `/stage-instances/{channel.id}` + * - PATCH `/stage-instances/{channel.id}` + * - DELETE `/stage-instances/{channel.id}` + */ + stageInstance(channelID: Snowflake) { + return `/stage-instances/${channelID}` as const; + }, }; export const RouteBases = { diff --git a/deno/rest/v8/stageInstance.ts b/deno/rest/v8/stageInstance.ts new file mode 100644 index 00000000..4025812c --- /dev/null +++ b/deno/rest/v8/stageInstance.ts @@ -0,0 +1,56 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v8/mod.ts'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export interface RESTPostAPIStageInstanceJSONBody { + /** + * The id of the stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * @default GuildOnly + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export type RESTPostAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#get-stage-instance + */ +export type RESTGetAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export interface RESTPatchAPIStageInstanceJSONBody { + /** + * The topic of the stage instance (1-120 characters) + */ + topic?: string; + /** + * The privacy level of the stage instance + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export type RESTPatchAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance + */ +export type RESTDeleteAPIStageInstanceResult = never; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index 3297f359..7087933a 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -10,6 +10,7 @@ export * from './guild.ts'; export * from './interactions.ts'; export * from './invite.ts'; export * from './oauth2.ts'; +export * from './stageInstance.ts'; export * from './template.ts'; export * from './user.ts'; export * from './voice.ts'; @@ -717,6 +718,24 @@ export const Routes = { guildWelcomeScreen(guildID: Snowflake) { return `/guilds/${guildID}/welcome-screen` as const; }, + + /** + * Route for: + * - POST `/stage-instances` + */ + stageInstances() { + return `/stage-instances` as const; + }, + + /** + * Route for: + * - GET `/stage-instances/{channel.id}` + * - PATCH `/stage-instances/{channel.id}` + * - DELETE `/stage-instances/{channel.id}` + */ + stageInstance(channelID: Snowflake) { + return `/stage-instances/${channelID}` as const; + }, }; export const RouteBases = { diff --git a/deno/rest/v9/stageInstance.ts b/deno/rest/v9/stageInstance.ts new file mode 100644 index 00000000..252185f9 --- /dev/null +++ b/deno/rest/v9/stageInstance.ts @@ -0,0 +1,56 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v9/mod.ts'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export interface RESTPostAPIStageInstanceJSONBody { + /** + * The id of the stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * @default GuildOnly + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export type RESTPostAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#get-stage-instance + */ +export type RESTGetAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export interface RESTPatchAPIStageInstanceJSONBody { + /** + * The topic of the stage instance (1-120 characters) + */ + topic?: string; + /** + * The privacy level of the stage instance + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export type RESTPatchAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance + */ +export type RESTDeleteAPIStageInstanceResult = never; diff --git a/gateway/v8.ts b/gateway/v8.ts index 9dae44c7..c9ba4c25 100644 --- a/gateway/v8.ts +++ b/gateway/v8.ts @@ -15,6 +15,7 @@ import type { APIMessage, APIMessageComponentInteraction, APIRole, + APIStageInstance, APIUnavailableGuild, APIUser, GatewayActivity, @@ -223,6 +224,9 @@ export const enum GatewayDispatchEvents { MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI', MessageUpdate = 'MESSAGE_UPDATE', PresenceUpdate = 'PRESENCE_UPDATE', + StageInstanceCreate = 'STAGE_INSTANCE_CREATE', + StageInstanceDelete = 'STAGE_INSTANCE_DELETE', + StageInstanceUpdate = 'STAGE_INSTANCE_UPDATE', Ready = 'READY', Resumed = 'RESUMED', TypingStart = 'TYPING_START', @@ -277,6 +281,9 @@ export type GatewayDispatchPayload = | GatewayMessageReactionRemoveEmojiDispatch | GatewayMessageUpdateDispatch | GatewayPresenceUpdateDispatch + | GatewayStageInstanceCreateDispatch + | GatewayStageInstanceDeleteDispatch + | GatewayStageInstanceUpdateDispatch | GatewayReadyDispatch | GatewayResumedDispatch | GatewayTypingStartDispatch @@ -1135,6 +1142,45 @@ export type GatewayPresenceUpdateDispatch = DataPayload< */ export type GatewayPresenceUpdateDispatchData = RawGatewayPresenceUpdate; +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceCreate, + GatewayStageInstanceCreateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceDelete, + GatewayStageInstanceDeleteDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceUpdate, + GatewayStageInstanceUpdateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatchData = APIStageInstance; + /** * https://discord.com/developers/docs/topics/gateway#typing-start */ diff --git a/gateway/v9.ts b/gateway/v9.ts index f74de589..8ebefa56 100644 --- a/gateway/v9.ts +++ b/gateway/v9.ts @@ -15,6 +15,7 @@ import type { APIMessage, APIMessageComponentInteraction, APIRole, + APIStageInstance, APIThreadMember, APIUnavailableGuild, APIUser, @@ -226,6 +227,9 @@ export const enum GatewayDispatchEvents { MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI', MessageUpdate = 'MESSAGE_UPDATE', PresenceUpdate = 'PRESENCE_UPDATE', + StageInstanceCreate = 'STAGE_INSTANCE_CREATE', + StageInstanceDelete = 'STAGE_INSTANCE_DELETE', + StageInstanceUpdate = 'STAGE_INSTANCE_UPDATE', Ready = 'READY', Resumed = 'RESUMED', ThreadCreate = 'THREAD_CREATE', @@ -1148,6 +1152,45 @@ export type GatewayPresenceUpdateDispatch = DataPayload< */ export type GatewayPresenceUpdateDispatchData = RawGatewayPresenceUpdate; +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceCreate, + GatewayStageInstanceCreateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-create + */ +export type GatewayStageInstanceCreateDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceDelete, + GatewayStageInstanceDeleteDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-delete + */ +export type GatewayStageInstanceDeleteDispatchData = APIStageInstance; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatch = DataPayload< + GatewayDispatchEvents.StageInstanceUpdate, + GatewayStageInstanceUpdateDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#stage-instance-update + */ +export type GatewayStageInstanceUpdateDispatchData = APIStageInstance; + /** * https://discord.com/developers/docs/topics/gateway#thread-list-sync */ diff --git a/payloads/v8/guild.ts b/payloads/v8/guild.ts index 8b36bd13..40fda841 100644 --- a/payloads/v8/guild.ts +++ b/payloads/v8/guild.ts @@ -7,6 +7,7 @@ import type { APIChannel } from './channel'; import type { APIEmoji } from './emoji'; import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway'; import type { APIRole } from './permissions'; +import type { APIStageInstance } from './stageInstance'; import type { APIUser } from './user'; import type { GatewayVoiceState } from './voice'; @@ -309,6 +310,14 @@ export interface APIGuild extends APIPartialGuild { * See https://support.discord.com/hc/en-us/articles/1500005389362-NSFW-Server-Designation */ nsfw: boolean; + /** + * The stage instances in the guild + * + * **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event** + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure + */ + stage_instances?: APIStageInstance[]; } /** diff --git a/payloads/v8/index.ts b/payloads/v8/index.ts index fa90579b..5aa2547f 100644 --- a/payloads/v8/index.ts +++ b/payloads/v8/index.ts @@ -7,6 +7,7 @@ export * from './interactions'; export * from './invite'; export * from './oauth2'; export * from './permissions'; +export * from './stageInstance'; export * from './teams'; export * from './template'; export * from './user'; diff --git a/payloads/v8/invite.ts b/payloads/v8/invite.ts index 156e55fd..87b5b2ec 100644 --- a/payloads/v8/invite.ts +++ b/payloads/v8/invite.ts @@ -5,6 +5,7 @@ import type { APIPartialChannel } from './channel'; import type { APIPartialGuild } from './guild'; import type { APIApplication } from './oauth2'; +import type { APIInviteStageInstance } from './stageInstance'; import type { APIUser } from './user'; /** @@ -63,6 +64,10 @@ export interface APIInvite { * The expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true` */ expires_at?: string | null; + /** + * The stage instance data if there is a public stage instance in the stage channel this invite is for + */ + stage_instance?: APIInviteStageInstance; } /** diff --git a/payloads/v8/stageInstance.ts b/payloads/v8/stageInstance.ts new file mode 100644 index 00000000..effcaf49 --- /dev/null +++ b/payloads/v8/stageInstance.ts @@ -0,0 +1,72 @@ +import type { Snowflake } from '../../globals'; +import type { APIGuildMember } from './guild'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object + */ +export interface APIStageInstance { + /** + * The id of the stage instance + */ + id: Snowflake; + /** + * The guild id of the associated stage channel + */ + guild_id: Snowflake; + /** + * The id of the associated stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ + privacy_level: StageInstancePrivacyLevel; + /** + * Whether or not stage discovery is disabled + */ + discoverable_disabled: boolean; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ +export const enum StageInstancePrivacyLevel { + /** + * The stage instance is visible publicly, such as on stage discovery + */ + Public = 1, + /** + * The stage instance is visible to only guild members + */ + GuildOnly, +} + +/** + * https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure + */ +export interface APIInviteStageInstance { + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The number of users in the stage + */ + participant_count: number; + /** + * The number of users speaking in the stage + */ + speaker_count: number; + /** + * The members speaking in the stage + * + * See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure + */ + members: APIGuildMember[]; +} diff --git a/payloads/v9/guild.ts b/payloads/v9/guild.ts index 4b3c30d9..1079d7bb 100644 --- a/payloads/v9/guild.ts +++ b/payloads/v9/guild.ts @@ -7,6 +7,7 @@ import type { APIChannel } from './channel'; import type { APIEmoji } from './emoji'; import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway'; import type { APIRole } from './permissions'; +import type { APIStageInstance } from './stageInstance'; import type { APIUser } from './user'; import type { GatewayVoiceState } from './voice'; @@ -317,6 +318,14 @@ export interface APIGuild extends APIPartialGuild { * See https://support.discord.com/hc/en-us/articles/1500005389362-NSFW-Server-Designation */ nsfw: boolean; + /** + * The stage instances in the guild + * + * **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event** + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure + */ + stage_instances?: APIStageInstance[]; } /** diff --git a/payloads/v9/index.ts b/payloads/v9/index.ts index fa90579b..5aa2547f 100644 --- a/payloads/v9/index.ts +++ b/payloads/v9/index.ts @@ -7,6 +7,7 @@ export * from './interactions'; export * from './invite'; export * from './oauth2'; export * from './permissions'; +export * from './stageInstance'; export * from './teams'; export * from './template'; export * from './user'; diff --git a/payloads/v9/invite.ts b/payloads/v9/invite.ts index 156e55fd..87b5b2ec 100644 --- a/payloads/v9/invite.ts +++ b/payloads/v9/invite.ts @@ -5,6 +5,7 @@ import type { APIPartialChannel } from './channel'; import type { APIPartialGuild } from './guild'; import type { APIApplication } from './oauth2'; +import type { APIInviteStageInstance } from './stageInstance'; import type { APIUser } from './user'; /** @@ -63,6 +64,10 @@ export interface APIInvite { * The expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true` */ expires_at?: string | null; + /** + * The stage instance data if there is a public stage instance in the stage channel this invite is for + */ + stage_instance?: APIInviteStageInstance; } /** diff --git a/payloads/v9/stageInstance.ts b/payloads/v9/stageInstance.ts new file mode 100644 index 00000000..effcaf49 --- /dev/null +++ b/payloads/v9/stageInstance.ts @@ -0,0 +1,72 @@ +import type { Snowflake } from '../../globals'; +import type { APIGuildMember } from './guild'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object + */ +export interface APIStageInstance { + /** + * The id of the stage instance + */ + id: Snowflake; + /** + * The guild id of the associated stage channel + */ + guild_id: Snowflake; + /** + * The id of the associated stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ + privacy_level: StageInstancePrivacyLevel; + /** + * Whether or not stage discovery is disabled + */ + discoverable_disabled: boolean; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level + */ +export const enum StageInstancePrivacyLevel { + /** + * The stage instance is visible publicly, such as on stage discovery + */ + Public = 1, + /** + * The stage instance is visible to only guild members + */ + GuildOnly, +} + +/** + * https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure + */ +export interface APIInviteStageInstance { + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The number of users in the stage + */ + participant_count: number; + /** + * The number of users speaking in the stage + */ + speaker_count: number; + /** + * The members speaking in the stage + * + * See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure + */ + members: APIGuildMember[]; +} diff --git a/rest/v8/index.ts b/rest/v8/index.ts index 0bdd5f14..c8b18aeb 100644 --- a/rest/v8/index.ts +++ b/rest/v8/index.ts @@ -10,6 +10,7 @@ export * from './guild'; export * from './interactions'; export * from './invite'; export * from './oauth2'; +export * from './stageInstance'; export * from './template'; export * from './user'; export * from './voice'; @@ -659,6 +660,24 @@ export const Routes = { guildWelcomeScreen(guildID: Snowflake) { return `/guilds/${guildID}/welcome-screen` as const; }, + + /** + * Route for: + * - POST `/stage-instances` + */ + stageInstances() { + return `/stage-instances` as const; + }, + + /** + * Route for: + * - GET `/stage-instances/{channel.id}` + * - PATCH `/stage-instances/{channel.id}` + * - DELETE `/stage-instances/{channel.id}` + */ + stageInstance(channelID: Snowflake) { + return `/stage-instances/${channelID}` as const; + }, }; export const RouteBases = { diff --git a/rest/v8/stageInstance.ts b/rest/v8/stageInstance.ts new file mode 100644 index 00000000..0fe8493d --- /dev/null +++ b/rest/v8/stageInstance.ts @@ -0,0 +1,56 @@ +import type { Snowflake } from '../../globals'; +import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v8/index'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export interface RESTPostAPIStageInstanceJSONBody { + /** + * The id of the stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * @default GuildOnly + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export type RESTPostAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#get-stage-instance + */ +export type RESTGetAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export interface RESTPatchAPIStageInstanceJSONBody { + /** + * The topic of the stage instance (1-120 characters) + */ + topic?: string; + /** + * The privacy level of the stage instance + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export type RESTPatchAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance + */ +export type RESTDeleteAPIStageInstanceResult = never; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index 6a3c8e1f..7d9578b2 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -10,6 +10,7 @@ export * from './guild'; export * from './interactions'; export * from './invite'; export * from './oauth2'; +export * from './stageInstance'; export * from './template'; export * from './user'; export * from './voice'; @@ -717,6 +718,24 @@ export const Routes = { guildWelcomeScreen(guildID: Snowflake) { return `/guilds/${guildID}/welcome-screen` as const; }, + + /** + * Route for: + * - POST `/stage-instances` + */ + stageInstances() { + return `/stage-instances` as const; + }, + + /** + * Route for: + * - GET `/stage-instances/{channel.id}` + * - PATCH `/stage-instances/{channel.id}` + * - DELETE `/stage-instances/{channel.id}` + */ + stageInstance(channelID: Snowflake) { + return `/stage-instances/${channelID}` as const; + }, }; export const RouteBases = { diff --git a/rest/v9/stageInstance.ts b/rest/v9/stageInstance.ts new file mode 100644 index 00000000..6a0a829d --- /dev/null +++ b/rest/v9/stageInstance.ts @@ -0,0 +1,56 @@ +import type { Snowflake } from '../../globals'; +import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v9/index'; + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export interface RESTPostAPIStageInstanceJSONBody { + /** + * The id of the stage channel + */ + channel_id: Snowflake; + /** + * The topic of the stage instance (1-120 characters) + */ + topic: string; + /** + * The privacy level of the stage instance + * + * @default GuildOnly + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#create-stage-instance + */ +export type RESTPostAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#get-stage-instance + */ +export type RESTGetAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export interface RESTPatchAPIStageInstanceJSONBody { + /** + * The topic of the stage instance (1-120 characters) + */ + topic?: string; + /** + * The privacy level of the stage instance + */ + privacy_level?: StageInstancePrivacyLevel; +} + +/** + * https://discord.com/developers/docs/resources/stage-instance#update-stage-instance + */ +export type RESTPatchAPIStageInstanceResult = APIStageInstance; + +/** + * https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance + */ +export type RESTDeleteAPIStageInstanceResult = never;