Advertisement
Guest User

nowplaying.js

a guest
Jan 24th, 2020
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { Utils } = require("erela.js")
  2. const { MessageEmbed } = require("discord.js")
  3.  
  4. module.exports = {
  5.     name: "nowplaying",
  6.     category: "music",
  7.     description: "displays the music thats playing",
  8.     run: async (bot, message, args) => {
  9.         const player = bot.music.players.get(message.guild.id);
  10.         if (!player || !player.queue[0]) return message.channel.send("No song/s currently playing within this guild.");
  11.           if (player.position > 5000){
  12.             getnowplaying()
  13.           }
  14.           if (player.position < 5000){
  15.             setTimeout(() => {
  16.             getnowplaying()
  17.             },3000)
  18.           }
  19.          
  20.           function getnowplaying(){
  21.           let { title, author, duration, thumbnail, requester } = player.queue[0];
  22.           let amount = `00:${Utils.formatTime(player.position, true)}`
  23.           const part = Math.floor((player.position / duration) * 10);
  24.           const giveEmbed = new MessageEmbed()
  25.             .setColor("AQUA")
  26.             .setDescription(`${player.playing ? "▶️" : "⏸️"} Currently Playing ${title}\n${"▬".repeat(part) + "🔘" + "▬".repeat(10 - part)}[${amount} / ${Utils.formatTime(duration, true)}]\nRequested By: ${requester.tag}`)
  27.  
  28.         message.channel.send({embed: giveEmbed}).then(m => {
  29.           const counter = setInterval(() => {
  30.             if(player.playing !== true){
  31.               clearInterval(counter)
  32.             }
  33.           if(player.position < 60000){
  34.             if(player.playing === true){
  35.             let { title, author, duration, thumbnail, requester } = player.queue[0];
  36.             let amount = `00:${Utils.formatTime(player.position, true)}`
  37.             const part = Math.floor((player.position / duration) * 10);
  38.             giveEmbed.setDescription(`${player.playing ? "▶️" : "⏸️"} Currently Playing ${title}\n${"▬".repeat(part) + "🔘" + "▬".repeat(10 - part)}[${amount} / ${Utils.formatTime(duration, true)}]\nRequested By: ${requester.tag}`)
  39.             }
  40.           }else{
  41.             if(player.playing === true){
  42.             let { title, author, duration, thumbnail, requester } = player.queue[0];
  43.             const amount = `${Utils.formatTime(player.position, true)}`
  44.             const part = Math.floor((player.position / duration) * 10);
  45.             giveEmbed.setDescription(`${player.playing ? "▶️" : "⏸️"} Currently Playing ${title}\n${"▬".repeat(part) + "🔘" + "▬".repeat(9 - part)}[${amount} / ${Utils.formatTime(duration, true)}]\nRequested By: ${requester.tag}`)
  46.           }
  47.         }
  48.           m.edit(giveEmbed)
  49.           },4000)
  50.       })
  51.     }
  52.   }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement