woomy/src/commands/nowplaying.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-01-25 10:02:43 +00:00
const Discord = require("discord.js");
exports.run = async (client, message) => {
let guild = client.music.getGuild(message.guild.id);
if(guild.queue.length < 1) {
return message.channel.send("<:error:466995152976871434> Nothing is playing.");
}
var song = guild.queue[0];
2020-03-09 01:11:33 +00:00
var elapsedTime = client.createTimestamp(guild.dispatcher.streamTime / 1000);
2020-01-25 10:02:43 +00:00
var timestamp;
if(song.duration == 0) {
timestamp = "`[LIVE]`";
} else {
timestamp = `\`[${elapsedTime + "/" + client.createTimestamp(song.duration)}]\``;
};
2020-03-09 01:11:33 +00:00
embed = new Discord.MessageEmbed();
2020-01-25 10:02:43 +00:00
embed.setTitle("Now playing:")
embed.setThumbnail(song.thumbnail)
embed.setColor(client.embedColour(message));
embed.setDescription(`**[${song.title}](https://www.youtube.com/watch?v=${song.id})**`)
embed.addField("Channel:", song.author, true)
embed.addField("Time:", timestamp, true)
2020-03-16 01:21:19 +00:00
embed.setFooter("Requested by " + song.requestedBy.tag, song.requestedBy.avatarURL({format: "png", dynamic: true, size: 2048}))
2020-01-25 10:02:43 +00:00
message.channel.send(embed)
};
exports.conf = {
enabled: true,
guildOnly: true,
aliases: ["np"],
permLevel: "User",
requiredPerms: ["EMBED_LINKS"]
};
exports.help = {
name: "nowplaying",
category: "Music",
description: "Shows details about the currently playing song.",
usage: "nowplaying"
};