remove stage channels for now

This commit is contained in:
Snowflake107 2021-05-10 11:00:24 +05:45
parent 49087bcec1
commit e16811b4c8
2 changed files with 8 additions and 6 deletions

View file

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

View file

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