fix(Player): check connection before setting channel

This commit is contained in:
DevAndromeda 2021-08-23 18:25:25 +05:45
parent 2344265fda
commit edc54bb38a
No known key found for this signature in database
GPG key ID: FA40E3EC5CB6DCD6
2 changed files with 4 additions and 2 deletions

View file

@ -1,4 +1,6 @@
require("dotenv").config();
require("dotenv").config({
path: __dirname+"/.env"
});
const { Client, GuildMember, Intents } = require("discord.js");
const config = require("./config");
const { Player, QueryType, QueueRepeatMode } = require("discord-player");

View file

@ -77,7 +77,7 @@ class Player extends EventEmitter<PlayerEvents> {
if (!queue) return;
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) {