Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (command === `${prefix2}search`) {
- const search = require('yt-search');
- search(args.join(' '), function(err, res) {
- console.log(res)
- // if (err) return message.channel.send("er is iets fout gegaan");
- var videos = res.videos.slice(0, 5);
- var response = " ";
- for (var i in videos) {
- response += `**[${parseInt(i)+1}]** ${videos[i].title}\r\n`;
- }
- response += `Welke video wil je afspelen? kies een uit 1-${videos.length}`;
- message.channel.send(responce);
- const filter = music => !isNaN(music.content) && music.content < videos.length && music.content > 0;
- const Collection = message.channel.createMessageCollector(filter);
- Collection.videos = videos;
- Collection.once('collect', function(music) {
- var options = { seek: 2, volume: 1, bitrate: 128000 };
- var playvid = (parseInt(music.content) - 1).url
- var voiceConnection = message.member.voiceChannel.join()
- .then(voiceChannel => {
- var stream = ytdl(playvis, { filter: 'audioonly' });
- var stramdispatch = voiceChannel.playStream(stream, options);
- })
- .catch(console.log)
- message.channel.send(`Nu aan het spelen: ${(parseInt(music.content) - 1).title}`);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement