From e16811b4c8dd78252346148b33cab9ed13b7d9c1 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Mon, 10 May 2021 11:00:24 +0545 Subject: [PATCH] remove stage channels for now --- src/Player.ts | 8 +++++--- src/utils/Util.ts | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Player.ts b/src/Player.ts index bc4bfa5..ad5730a 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -1046,15 +1046,17 @@ export class Player extends EventEmitter { if (!oldState.channelID || newState.channelID) { const emptyTimeout = this._cooldownsTimeout.get(`empty_${oldState.guild.id}`); - const channelEmpty = Util.isVoiceEmpty(queue.voiceConnection.channel); + + // @todo: stage channels + const channelEmpty = Util.isVoiceEmpty(queue.voiceConnection.channel as VoiceChannel); if (!channelEmpty && emptyTimeout) { clearTimeout(emptyTimeout); this._cooldownsTimeout.delete(`empty_${oldState.guild.id}`); } } else { - if (!Util.isVoiceEmpty(queue.voiceConnection.channel)) return; + if (!Util.isVoiceEmpty(queue.voiceConnection.channel as VoiceChannel)) return; const timeout = setTimeout(() => { - if (!Util.isVoiceEmpty(queue.voiceConnection.channel)) return; + if (!Util.isVoiceEmpty(queue.voiceConnection.channel as VoiceChannel)) return; if (!this.queues.has(queue.guildID)) return; queue.voiceConnection.channel.leave(); this.queues.delete(queue.guildID); diff --git a/src/utils/Util.ts b/src/utils/Util.ts index c444c84..7826f5d 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -4,7 +4,7 @@ import YouTube from 'youtube-sr'; import { Track } from '../Structures/Track'; // @ts-ignore import { validateURL as SoundcloudValidateURL } from 'soundcloud-scraper'; -import { StageChannel, VoiceChannel } from 'discord.js'; +import { VoiceChannel } from 'discord.js'; const spotifySongRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/; const spotifyPlaylistRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:playlist\/|\?uri=spotify:playlist:)((\w|-){22})/; @@ -190,10 +190,10 @@ export class Util { /** * Checks if the given voice channel is empty - * @param {DiscordVoiceChannel|DiscordStageChannel} channel The voice channel + * @param {DiscordVoiceChannel} channel The voice channel * @returns {Boolean} */ - static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean { + static isVoiceEmpty(channel: VoiceChannel): boolean { return channel.members.filter((member) => !member.user.bot).size === 0; }