feat: add typings for stage instance (#144)

This commit is contained in:
Shubham Parihar
2021-06-24 14:42:03 +05:30
committed by GitHub
parent dd12c6ac99
commit e36ef9e1d2
29 changed files with 828 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
{
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib"
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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[];
}
/**

View File

@@ -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/<code>` 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;
}
/**

View File

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

View File

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

View File

@@ -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[];
}
/**

View File

@@ -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/<code>` 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;
}
/**

View File

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

View File

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

View File

@@ -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 = {

View File

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

View File

@@ -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 = {

View File

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

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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[];
}
/**

View File

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

View File

@@ -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/<code>` 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;
}
/**

View File

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

View File

@@ -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[];
}
/**

View File

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

View File

@@ -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/<code>` 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;
}
/**

View File

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

View File

@@ -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 = {

56
rest/v8/stageInstance.ts Normal file
View File

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

View File

@@ -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 = {

56
rest/v9/stageInstance.ts Normal file
View File

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