diff --git a/commands/now-playing.js b/commands/now-playing.js index f7e3f81..de05abb 100644 --- a/commands/now-playing.js +++ b/commands/now-playing.js @@ -6,9 +6,9 @@ module.exports.run = async (client, message) => { if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`); - const song = await client.player.nowPlaying(message.guild.id); + const track = await client.player.nowPlaying(message.guild.id); - message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`); + message.channel.send(`**Currently playing ${track.name} ${emotes.music}**`); }; diff --git a/commands/pause.js b/commands/pause.js index c47c072..ecd093b 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -8,9 +8,9 @@ module.exports.run = async (client, message) => { if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`); - const song = await client.player.pause(message.guild.id); + const track = await client.player.pause(message.guild.id); - message.channel.send(`**Song ${song.name} paused ${emotes.success}**`); + message.channel.send(`**Track ${track.name} paused ${emotes.success}**`); }; diff --git a/commands/play.js b/commands/play.js index 59431d2..f7bcc00 100644 --- a/commands/play.js +++ b/commands/play.js @@ -6,17 +6,27 @@ module.exports.run = async (client, message, args) => { if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`); - const aSongIsAlreadyPlaying = client.player.isPlaying(message.guild.id); + const aTrackIsAlreadyPlaying = client.player.isPlaying(message.guild.id); - // If there's already a song playing - if(aSongIsAlreadyPlaying){ - // Add the song to the queue - const song = await client.player.addToQueue(message.guild.id, args.join(" ")); - message.channel.send(`**Song ${song.name} added to queue ${emotes.music}**`); + // If there's already a track playing + if(aTrackIsAlreadyPlaying){ + // Add the track to the queue + const track = await client.player.addToQueue(message.guild.id, args.join(" ")); + message.channel.send(`**Track ${track.name} added to queue ${emotes.music}**`); } else { - // Else, play the song - const song = await client.player.play(message.member.voice.channel, args.join(" ")); - message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`); + // Else, play the track + const track = await client.player.play(message.member.voice.channel, args.join(" ")); + message.channel.send(`**Currently playing ${track.name} ${emotes.music}**`); + const queue = client.player.getQueue(message.guild.id) + .on('end', () => { + message.channel.send('There is no more music in the queue!'); + }) + .on('trackChanged', (oldTrack, newTrack) => { + message.channel.send(`Now playing ${newTrack.name}...`); + }) + .on('channelEmpty', () => { + message.channel.send('Stop playing, there is no more member in the voice channel...'); + }); } }; diff --git a/commands/queue.js b/commands/queue.js index 36d1309..55d565d 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -6,11 +6,14 @@ module.exports.run = async (client, message) => { const queue = client.player.getQueue(message.guild.id); - if(!queue) return message.channel.send(`**No songs currently playing ${emotes.error}**`); + if(!queue) return message.channel.send(`**No tracks currently playing ${emotes.error}**`); - message.channel.send(`**Server queue ${emotes.queue}** \n`+(queue.songs.map((song, i) => { - return `${i === 0 ? 'Current' : `#${i+1}`} - ${song.name} | ${song.author}` - }).join('\n'))); + message.channel.send(`**Server queue ${emotes.queue}** \nCurrent - ${queue.playing.name} | ${queue.playing.author}\n`+ + ( + queue.tracks.map((track, i) => { + return `#${i+1} - ${track.name} | ${track.author}` + }).join('\n') + )); }; diff --git a/commands/resume.js b/commands/resume.js index 0564d29..3b9a769 100644 --- a/commands/resume.js +++ b/commands/resume.js @@ -4,11 +4,11 @@ module.exports.run = async (client, message) => { if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`); - const song = await client.player.resume(message.guild.id); + const track = await client.player.resume(message.guild.id); - if(!song) return message.channel.send(`**No songs currently playing ${emotes.error}**`); + if(!track) return message.channel.send(`**No tracks currently playing ${emotes.error}**`); - message.channel.send(`**Song ${song.name} resumed ${emotes.success}**`); + message.channel.send(`**Track ${track.name} resumed ${emotes.success}**`); }; diff --git a/commands/skip.js b/commands/skip.js index b1dd767..0c7b149 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -6,9 +6,9 @@ module.exports.run = async (client, message) => { if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`); - const song = await client.player.skip(message.guild.id); + const track = await client.player.skip(message.guild.id); - message.channel.send(`**Song ${song.name} skipped ${emotes.success}**`); + message.channel.send(`**Track ${track.name} skipped ${emotes.success}**`); };