Check if sound player is already connected, fallback for Lavalink node name

This commit is contained in:
Essem 2022-07-22 19:05:34 -05:00
parent 0135717854
commit 57827e6877
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
2 changed files with 2 additions and 2 deletions

View file

@ -43,7 +43,7 @@ class QueueCommand extends MusicCommand {
value: player.loop ? "Yes" : "No"
}, {
name: "🌐 Node",
value: player.node.name
value: player.node ? player.node.name : "Unknown"
}, {
name: "🗒️ Queue",
value: value !== "del" ? value.join("\n") : "There's nothing in the queue!"

View file

@ -94,7 +94,7 @@ export async function play(client, sound, options, music = false) {
const playlistTracks = response.playlistInfo.selectedTrack ? sortedTracks : [sortedTracks[0]];
queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, ...playlistTracks] : playlistTracks);
}
const connection = player && player.player && player.player.connection.state !== 3 ? player.player : await node.joinChannel({
const connection = player && player.player && player.player.connection.state !== 3 && player.player.connection.state !== 1 ? player.player : await node.joinChannel({
guildId: voiceChannel.guild.id,
channelId: voiceChannel.id,
shardId: voiceChannel.guild.shard.id,