Advertisement
dfhfjjfgjfsfeedgf

Untitled

Jan 13th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. const ytdl = require("ytdl-core");
  2.  
  3. exports.run = async (client, message, args, ops) => {
  4. if (!message.member.voiceChannel) return message.channel.send("Please connect to a voice channel so i can join!");
  5.  
  6. //this checks if the bot is in a voice channel already!
  7. if (message.guild.me.voiceChannel) return message.channel.send("Sorry, the bot is already in a voice channel!");
  8.  
  9. if (!args[0]) return message.channel.send("You didnt provide a link!");
  10.  
  11. let validate = await ytdl.validateURL(args[0]);
  12.  
  13. if (!validate) return message.channel.send("Please try again");
  14.  
  15. let info = await ytdl.getInfo(args[0]);
  16.  
  17. let connection = await message.member.voiceChannel.join();
  18.  
  19. let dispatcher = await connection.playStream(ytdl(args[0], { filter: `audioonly`}));
  20.  
  21. message.channel.send(`Now playing: ${info.title}`);
  22.  
  23.  
  24. }
  25.  
  26. module.exports.help = {
  27. name: "ghetrgiuvhd"
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement