Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ytdl = require('ytdl');
- const opusscript = require('opusscript');
- const ffmpeg = require('ffmpeg');
- exports.run = async (client, args, message, ops) => {
- if (!message.member.voiceChannel) return message.channel.send("please conect to a voice channel.");
- if (message.guild.me.voiceChannel) return message.channel.send("i'm already in the `voice Channel`.");
- if (!args[0]) return message.channel.send("Sorry , Please input a `url` folowing the command.");
- let validate = await ytdl.validateURL(args[0]);
- if (!validate) return message.channel.send("Sorry, please input a `valid` url folowing the command.");
- let info = await ytdl.getInfo(args[0]);
- let connecton = await message.member.voiceChannel.join();
- let dispatcher = await connecton.playStream(ytdl(args[0], { filter: 'audioonly' }));
- message.channel.send(`Now Playing : ${info.title}`);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement