const { MessageEmbed, MessageAttachment } = require("discord.js"); const musicGif = new MessageAttachment('./assets/img/Music.gif'); const { MESSAGES } = require("../../util/constants"); const createBar = require("string-progressbar"); module.exports.run = (client, message, args, settings) => { const channel = message.member.voice.channel; if (!channel) return message.channel.send('Tu dois te trouver dans un salon vocal pour utiliser cette commande'); let queue = message.client.queue.get(message.guild.id) if(!queue) return message.channel.send({ embed:{ title: `Aucune musique n'est lancé actuellement donc merci d'utiliser la commande \`${settings.prefix}play + URL\`! ` } }) const song = queue.songs[0]; const seek = (queue.connection.dispatcher.streamTime - queue.connection.dispatcher.pausedTime) / 1000; const left = song.duration - seek; let nowPlaying = new MessageEmbed() .setTitle("En lecture") .setDescription(`${song.title}\n${song.url}`) .setColor("#F8AA2A") .setAuthor(message.client.user.username) //.attachFiles(musicGif) //.setThumbnail('attachment://Music.gif') .setThumbnail('https://tenor.com/8P2l.gif'); var time = new Date(left * 1000).toISOString().substr(11, 8); if (song.duration > 0) { nowPlaying.addField( "\u200b", new Date(seek * 1000).toISOString().substr(11, 8) + "[" + createBar(song.duration == 0 ? seek : song.duration, seek, 20)[0] + "]" + (song.duration == 0 ? " ◉ LIVE" : new Date(song.duration * 1000).toISOString().substr(11, 8)), false ); nowPlaying.setFooter( (`Temps restant : ${time}`) ); } return message.channel.send(nowPlaying); }; module.exports.help = MESSAGES.COMMANDS.MUSIQUE.NOWPLAYING;