Advertisement
Guest User

main

a guest
Dec 11th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const ytdl = require('ytdl');
  2. const opusscript = require('opusscript');
  3. const ffmpeg = require('ffmpeg');
  4.  
  5. exports.run = async (client, args, message, ops) => {
  6.     if (!message.member.voiceChannel) return message.channel.send("please conect to a voice channel.");
  7.  
  8.     if (message.guild.me.voiceChannel) return message.channel.send("i'm already in the `voice Channel`.");
  9.  
  10.     if (!args[0]) return message.channel.send("Sorry , Please input a `url` folowing the command.");
  11.  
  12.     let validate = await ytdl.validateURL(args[0]);
  13.  
  14.  
  15.     if (!validate) return message.channel.send("Sorry, please input a `valid` url folowing the command.");
  16.  
  17.     let info = await ytdl.getInfo(args[0]);
  18.  
  19.     let connecton = await message.member.voiceChannel.join();
  20.  
  21.     let dispatcher = await connecton.playStream(ytdl(args[0], { filter: 'audioonly' }));
  22.  
  23.     message.channel.send(`Now Playing : ${info.title}`);
  24.  
  25. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement