fix(Player): check connection before setting channel
This commit is contained in:
parent
2344265fda
commit
edc54bb38a
2 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
||||||
require("dotenv").config();
|
require("dotenv").config({
|
||||||
|
path: __dirname+"/.env"
|
||||||
|
});
|
||||||
const { Client, GuildMember, Intents } = require("discord.js");
|
const { Client, GuildMember, Intents } = require("discord.js");
|
||||||
const config = require("./config");
|
const config = require("./config");
|
||||||
const { Player, QueryType, QueueRepeatMode } = require("discord-player");
|
const { Player, QueryType, QueueRepeatMode } = require("discord-player");
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Player extends EventEmitter<PlayerEvents> {
|
||||||
if (!queue) return;
|
if (!queue) return;
|
||||||
|
|
||||||
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId) {
|
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId) {
|
||||||
queue.connection.channel = newState.channel;
|
if (queue?.connection) queue.connection.channel = newState.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldState.channelId && newState.channelId && newState.member.id === newState.guild.me.id) {
|
if (!oldState.channelId && newState.channelId && newState.member.id === newState.guild.me.id) {
|
||||||
|
|
Loading…
Reference in a new issue