From 4f2c686691cbac026cee2722795b7cd887527f91 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:08:47 +0530 Subject: [PATCH] cookie example removed --- examples/YouTube/play - cookies.js | 48 ------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 examples/YouTube/play - cookies.js diff --git a/examples/YouTube/play - cookies.js b/examples/YouTube/play - cookies.js deleted file mode 100644 index edeb9fc..0000000 --- a/examples/YouTube/play - cookies.js +++ /dev/null @@ -1,48 +0,0 @@ -const discord = require('discord.js') -const { Intents } = require('discord.js') -const { createAudioPlayer, createAudioResource , StreamType, demuxProbe, joinVoiceChannel, NoSubscriberBehavior, AudioPlayerStatus, VoiceConnectionStatus, getVoiceConnection } = require('@discordjs/voice') -const play = require('play-dl') -const client = new discord.Client({ intents : [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.DIRECT_MESSAGES] , partials : ['CHANNEL', 'MESSAGE']}) -const token = '< YOUR BOT TOKEN >' -const COOKIE = '< YOUR COOKIES >' - - -client.on('messageCreate', async message => { - if(message.content.startsWith('!play')){ - if(!message.member.voice?.channel) return message.channel.send('Connect to a Voice Channel') - const connection = joinVoiceChannel({ - channelId : message.member.voice.channel.id, - guildId : message.guild.id, - adapterCreator: message.guild.voiceAdapterCreator - }) - - let args = message.content.split('play ')[1].split(' ')[0] - let stream = await play.stream(args, { cookie : COOKIE }) - /* - OR if you want to get info about youtube link and then stream it - - let yt_info = await play.video_info(args, { cookie : COOKIE }) - console.log(yt_info.video_details.title) - let stream = await play.stream_from_info(yt_info, { cookie : COOKIE }) - */ - - let resource = createAudioResource(stream.stream, { - inputType : stream.type - }) - let player = createAudioPlayer({ - behaviors: { - noSubscriber: NoSubscriberBehavior.Play - } - }) - player.play(resource) - - connection.subscribe(player) - } -}) - -client.on('ready', () => { - console.log(`We have logged in as ${client.user.tag}!`) -}) - -client.login(token); -