2020-04-30 04:06:09 +00:00
|
|
|
const { getGuild, createTimestamp } = require('../modules/music')
|
|
|
|
const { MessageEmbed } = require('discord.js')
|
2020-01-25 10:02:43 +00:00
|
|
|
exports.run = async (client, message) => {
|
2020-04-30 04:06:09 +00:00
|
|
|
const guild = getGuild(message.guild.id)
|
|
|
|
|
|
|
|
if (guild.queue.length < 1) {
|
|
|
|
return message.channel.send(client.config.emojis.error + ' Nothing is in the queue!')
|
2020-01-25 10:02:43 +00:00
|
|
|
}
|
|
|
|
|
2020-04-30 04:06:09 +00:00
|
|
|
const s = guild.queue[0]
|
|
|
|
const elapsedTime = createTimestamp(guild.dispatcher.streamTime / 1000)
|
|
|
|
let timestamp = `\`[${createTimestamp(s.video.lengthSeconds)}]\``
|
2020-01-25 10:02:43 +00:00
|
|
|
|
2020-04-30 04:06:09 +00:00
|
|
|
if (timestamp !== '`[LIVE]`') {
|
|
|
|
timestamp = `\`[${elapsedTime + '/' + createTimestamp(s.video.lengthSeconds)}]\``
|
|
|
|
}
|
2020-01-25 10:02:43 +00:00
|
|
|
|
2020-04-30 04:06:09 +00:00
|
|
|
const embed = new MessageEmbed()
|
|
|
|
embed.setTitle('Now playing')
|
2021-10-15 11:28:24 +00:00
|
|
|
embed.setThumbnail(client.config.endpoints.invidious + s.video.videoThumbnails[1].url)
|
2020-04-30 04:06:09 +00:00
|
|
|
embed.setColor(client.embedColour(message))
|
|
|
|
embed.setDescription(`**[${s.video.title}](https://www.youtube.com/watch?v=${s.video.videoId})**`)
|
|
|
|
embed.addField('Channel:', s.video.author, true)
|
|
|
|
embed.addField('Time:', timestamp, true)
|
|
|
|
embed.setFooter('Requested by ' + s.requestedBy.tag, s.requestedBy.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
|
2020-01-25 10:02:43 +00:00
|
|
|
|
2020-04-30 04:06:09 +00:00
|
|
|
message.channel.send(embed)
|
2020-01-25 10:02:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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"
|
|
|
|
};
|