⚡ Use track everywhere in the code
This commit is contained in:
@@ -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}**`);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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}**`);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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...');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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')
|
||||
));
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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}**`);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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}**`);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user