UNPKG

discordjs-ytdl

Version:

Great module for youtube video downloader for Discord Bots

32 lines (28 loc) 1.12 kB
const Discord = require('discord.js'); // discord.js modülü tanımlıyoruz. const client = new Discord.Client(); // client tanımalamsı const play = require('./index'); client.login("TOKEN"); client.on('message', async message => { // Voice only works in guilds, if the message does not come from a guild, // we ignore it try { if (!message.guild) return; if (message.content.startsWith('/play')) { // Only try to join the sender's voice channel if they are in one themselves if (message.member.voice.channel) { const connection = await message.member.voice.channel.join(); const args = message.content.split(' ').slice(1); play.play(connection, args.join(" "), "API KEY") const baslik = await play.title(args.join(" "), "API KEY") message.channel.send(baslik) } else { message.reply('You need to join a voice channel first!'); } } } catch(e){ console.log(e) } }); // THUMBNAIL const play = require('./index'); console.log(play.thumbnail('4w8Su0dRFAw'));