diff --git a/index.d.ts b/index.d.ts index 8c1120293..39312c180 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,7 +24,7 @@ declare namespace Eris { type AnyVoiceChannel = VoiceChannel | StageChannel; type ChannelTypes = Constants["ChannelTypes"][keyof Constants["ChannelTypes"]]; type GuildTextableChannel = TextChannel | NewsChannel | AnyThreadChannel; - type InviteChannel = InvitePartialChannel | Exclude; + type InviteChannel = InvitePartialChannel | Exclude; type PossiblyUncachedTextable = Textable | Uncached; type PossiblyUncachedTextableChannel = TextableChannel | Uncached; type TextableChannel = (GuildTextable & GuildTextableChannel) | (Textable & PrivateChannel); @@ -813,6 +813,12 @@ declare namespace Eris { recipients?: { username: string }[]; type: Exclude; } + interface InviteStageInstance { + members: Member[]; + participantCount: number; + speakerCount: number; + topic: string; + } // Member/User interface FetchMembersOptions { @@ -2320,6 +2326,7 @@ declare namespace Eris { maxUses: CT extends "withMetadata" ? number : null; memberCount: CT extends "withMetadata" | "withoutCount" ? null : number; presenceCount: CT extends "withMetadata" | "withoutCount" ? null : number; + stageInstance: CH extends StageChannel ? InviteStageInstance : null; temporary: CT extends "withMetadata" ? boolean : null; uses: CT extends "withMetadata" ? number : null; constructor(data: BaseData, client: Client); diff --git a/lib/structures/Invite.js b/lib/structures/Invite.js index 33c7c4026..cc6d7dbfb 100644 --- a/lib/structures/Invite.js +++ b/lib/structures/Invite.js @@ -5,7 +5,7 @@ const Guild = require("./Guild"); /** * Represents an invite. Some properties are only available when fetching invites from channels, which requires the Manage Channel permission. -* @prop {TextChannel | NewsChannel | VoiceChannel | GroupChannel | Object} channel Info on the invite channel +* @prop {TextChannel | NewsChannel | VoiceChannel | GroupChannel | StageChannel | Object} channel Info on the invite channel * @prop {String} channel.id The ID of the invite's channel * @prop {String?} channel.name The name of the invite's channel * @prop {Number} channel.type The type of the invite's channel @@ -18,6 +18,7 @@ const Guild = require("./Guild"); * @prop {Number?} maxUses The max number of invite uses * @prop {Number?} memberCount The **approximate** member count for the guild * @prop {Number?} presenceCount The **approximate** presence count for the guild +* @prop {Object?} stageInstance The active public stage instance data for the stage channel this invite is for * @prop {Boolean?} temporary Whether the invite grants temporary membership or not * @prop {Number?} uses The number of invite uses */ @@ -48,6 +49,20 @@ class Invite extends Base { this._createdAt = data.created_at !== undefined ? data.created_at : null; this.presenceCount = data.approximate_presence_count !== undefined ? data.approximate_presence_count : null; this.memberCount = data.approximate_member_count !== undefined ? data.approximate_member_count : null; + if(data.stage_instance !== undefined) { + data.stage_instance.members = data.stage_instance.members.map((m) => { + m.id = m.user.id; + return m; + }); + this.stageInstance = { + members: this.guild.members.update(data.stage_instance.members, this.guild), + participantCount: data.stage_instance.participant_count, + speakerCount: data.stage_instance.speaker_count, + topic: data.stage_instance.topic + }; + } else { + this.stageInstance = null; + } } get createdAt() {