Skip to content

Commit

Permalink
Add now playing (np) command
Browse files Browse the repository at this point in the history
  • Loading branch information
eritislami committed Jun 8, 2020
1 parent 4ea302f commit d9a94d2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions commands/nowplaying.js
@@ -0,0 +1,22 @@
const { MessageEmbed } = require("discord.js");

module.exports = {
name: "np",
description: "Show now playing song",
execute(message) {
const serverQueue = message.client.queue.get(message.guild.id);
if (!serverQueue) return message.reply("There is nothing playing.").catch(console.error);
const song = serverQueue.songs[0];

let nowPlaying = new MessageEmbed()
.setTitle("Now playing")
.setDescription(`${song.title}\n${song.url}`)
.setColor("#F8AA2A")
.setAuthor("EvoBot")
.setTimestamp();

if (song.duration > 0) nowPlaying.setFooter(new Date(song.duration * 1000).toISOString().substr(11, 8));

return message.channel.send(nowPlaying);
}
};

0 comments on commit d9a94d2

Please sign in to comment.