G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 166 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function play(connection, message){
  2.         var server = servers[message.guild.id];
  3.         server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));
  4.  
  5.         server.queue.shift();
  6.  
  7.         server.dispatcher.on("end", function(){
  8.             if(server.queue[0]){
  9.                 play(connection, message);
  10.             } else {
  11.                 connection.disconnect();
  12.             };
  13.         });
  14.     };
  15.  
  16.     const url = args[1];
  17.     const PREFIX = "b!";
  18.  
  19.     if (!message.member.voiceChannel){
  20.         message.delete();
  21.         return message.channel.send("You must be in a \`voice channel\` to use this command!")
  22.         .then(m => m.delete(5000));
  23.     };
  24.  
  25.     if (!url){
  26.         message.delete();
  27.         return message.channel.send(`Please use \`${PREFIX}play [yt url]\` to play music!`)
  28.         .then(m => m.delete(3000));
  29.     };
  30.  
  31.     if (!ytdl.validateURL(url)){
  32.         message.delete();
  33.         return message.channel.send(`That is not a \`valid URL\` :(`)
  34.         .then(m => m.delete(5000));
  35.     };
  36.  
  37.     if(!servers[message.guild.id]) servers[message.guild.id] = {
  38.         queue: []
  39.     };
  40.  
  41.     const server = servers[message.guild.id];
  42.    
  43.     // do
  44.     if(message.guild.me.voiceChannel){
  45.         const embedPlay2 = new Discord.RichEmbed()
  46.             .setTitle(`Music :musical_note:`)
  47.             .setDescription(`I have added this [song](${url}) to the queue`);
  48.  
  49.         server.queue.push(url);
  50.         return message.channel.send(embedPlay2);
  51.     };
  52.  
  53.     if(!message.guild.me.voicechannel){
  54.         const embedPlay = new Discord.RichEmbed()
  55.             .setTitle(`Music :musical_note:`)
  56.             .setDescription(`I started playing this [song](${url})`);
  57.  
  58.         server.queue.push(url);
  59.         message.channel.send(embedPlay);
  60.         message.member.voiceChannel.join()
  61.         .then(function(connection){
  62.             play(connection, message);
  63.         });
  64.     };
  65. }};
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top