queue: check connection before ending

This commit is contained in:
Snowflake107 2021-07-04 13:54:32 +05:45
parent 91c56751a7
commit 5b761308a0

View file

@ -193,7 +193,7 @@ class Queue<T = unknown> {
*/ */
destroy(disconnect = this.options.leaveOnStop) { destroy(disconnect = this.options.leaveOnStop) {
this.#watchDestroyed(); this.#watchDestroyed();
this.connection.end(); if (this.connection) this.connection.end();
if (disconnect) this.connection.disconnect(); if (disconnect) this.connection.disconnect();
this.player.queues.delete(this.guild.id); this.player.queues.delete(this.guild.id);
this.player.voiceUtils.cache.delete(this.guild.id); this.player.voiceUtils.cache.delete(this.guild.id);