From e3b9d4699864644a0bce5795aa6f0be6536a7645 Mon Sep 17 00:00:00 2001 From: ION606 Date: Sat, 30 Apr 2022 20:15:55 -0400 Subject: [PATCH] Adding the ability to join whatever vc the user is in --- commands/playAudio.js | 9 ++++++--- main.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/commands/playAudio.js b/commands/playAudio.js index b0d1b89..52421e8 100644 --- a/commands/playAudio.js +++ b/commands/playAudio.js @@ -31,9 +31,12 @@ module.exports = { https://github.com/porridgewithraisins/jam-bot#known-bugs) const stream = await ytdl(url, { filter: 'audioonly' }); */ - // const channel = bot.channels.cache.get("930148609406685227"); - const channel = message.member.guild.voice.channel; - if (!channel) { message.reply("Please join a voice channel before you try this!"); } + + if (!message.member.voice.channel) { + message.reply("Please join a voice channel before you try this!"); + return; + } + const channel = bot.channels.cache.get(message.member.voice.channel.id); const connection = joinVoiceChannel({ channelId: channel.id, diff --git a/main.js b/main.js index 1b9174c..d1183f9 100644 --- a/main.js +++ b/main.js @@ -105,4 +105,4 @@ bot.on('messageCreate', (message) => { //Last Line -bot.login(process.env.token); \ No newline at end of file +bot.login("OTQ0MDQ2OTAyNDE1MDkzNzYw.Yg76MQ.A4V6Tqvrhuvq8nCafABCBrx8uuM"); \ No newline at end of file