UNPKG

detritus-client

Version:

A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.

75 lines (74 loc) 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StageInstance = void 0; const basecollection_1 = require("../collections/basecollection"); const baseset_1 = require("../collections/baseset"); const constants_1 = require("../constants"); const basestructure_1 = require("./basestructure"); const keysStageInstance = new baseset_1.BaseSet([ constants_1.DiscordKeys.CHANNEL_ID, constants_1.DiscordKeys.DISCOVERABLE_DISABLED, constants_1.DiscordKeys.GUILD_ID, constants_1.DiscordKeys.GUILD_SCHEDULED_EVENT_ID, constants_1.DiscordKeys.ID, constants_1.DiscordKeys.INVITE_CODE, constants_1.DiscordKeys.PRIVACY_LEVEL, constants_1.DiscordKeys.TOPIC, ]); /** * Stage Instance Structure * @category Structure */ class StageInstance extends basestructure_1.BaseStructure { constructor(client, data, isClone) { super(client, undefined, isClone); this._keys = keysStageInstance; this.channelId = ''; this.deleted = false; this.discoverableDisabled = false; this.guildId = ''; this.guildScheduledEventId = null; this.id = ''; this.inviteCode = null; this.privacyLevel = constants_1.StagePrivacyLevels.PUBLIC; this.topic = ''; this.merge(data); } get channel() { return this.client.channels.get(this.channelId) || null; } get guild() { return this.client.guilds.get(this.guildId) || null; } get isGuildOnly() { return this.privacyLevel === constants_1.StagePrivacyLevels.GUILD_ONLY; } get isPublic() { return this.privacyLevel === constants_1.StagePrivacyLevels.PUBLIC; } get listeners() { return basecollection_1.emptyBaseCollection; } get moderators() { return basecollection_1.emptyBaseCollection; } get speakers() { return basecollection_1.emptyBaseCollection; } get voiceStates() { if (this.client.voiceStates.has(this.channelId)) { return this.client.voiceStates.get(this.channelId); } return basecollection_1.emptyBaseCollection; } edit(options = {}) { return this.client.rest.editStageInstance(this.channelId, options); } fetch() { return this.client.rest.fetchStageInstance(this.channelId); } delete() { return this.client.rest.deleteStageInstance(this.channelId); } } exports.StageInstance = StageInstance;