Advertisement
dfhfjjfgjfsfeedgf

Untitled

May 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. if (!message.member.voiceChannel) return message.channel.send(`Please connect to a voice channel ${message.author}`);
  2.  
  3. //checks if the bot is already connected to a voice channel
  4. if (message.guild.me.voiceChannel) return message.channel.send("Sorry, the bot is already connected to a voice channel");
  5.  
  6. //checks if the person put a url
  7. if (!args[0]) return message.channel.send(" Uh oh, something turned into a oof try again!");
  8.  
  9. //validate info
  10. let validate = await ytdl.validateURL(args[0]);
  11.  
  12. //checks validation
  13. if (!validate) return message.channel.send("Uhhhh wa happend? Try again please");
  14.  
  15. //fetches video information
  16. let info = await ytdl.getInfo(args[0]);
  17.  
  18. //stores authors guild channels
  19. let connection = await message.member.voiceChannel.join();
  20.  
  21. //plays the song with url
  22. let dispatcher = await connection.playStream(ytdl(args[0], { filter: `audioonly`}));
  23.  
  24. //song now playing
  25. message.channel.send(`Now playing: ${info.title}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement