play: check if bot is already connected
This commit is contained in:
parent
b74152f7b9
commit
86ae74f2e3
1 changed files with 5 additions and 3 deletions
|
@ -95,11 +95,13 @@ class Player {
|
|||
// Searches the song
|
||||
let video = await Util.getFirstYoutubeResult(songName, this.SYA);
|
||||
if(!video) reject('Song not found');
|
||||
// Joins the voice channel
|
||||
let connection = await voiceChannel.join();
|
||||
if(!voiceChannel.guild.me.voice.channel || (voiceChannel.guild.me.voice.channel.id !== voiceChannel.id)){
|
||||
// Joins the voice channel
|
||||
await voiceChannel.join();
|
||||
}
|
||||
// Creates a new guild with data
|
||||
let queue = new Queue(voiceChannel.guild.id);
|
||||
queue.connection = connection;
|
||||
queue.connection = voiceChannel.guild.me.voice.connection;
|
||||
let song = new Song(video, queue);
|
||||
queue.songs.push(song);
|
||||
// Add the queue to the list
|
||||
|
|
Loading…
Reference in a new issue