How do I grab the voice channel the bot is currently connected to?

Heres is the breakdown: CONTEXT: I am trying to make a simple if statement, that compares the guild ID of the voice channel from the user, to the guild ID of the bot's current channel. PROBLEM: I am incorrectly grabbing the ID of the bots current channel. These are my two commands:
const voiceChannel = interaction.member.voice.channel;
const currentChannel = interaction.guild.members.me.voice;
const voiceChannel = interaction.member.voice.channel;
const currentChannel = interaction.guild.members.me.voice;
The second one I got off Google, but it just grabs the same value. I'm looking through the docs but I'm misunderstanding something because nothing is working. QUESTION: How do I get the ID of the bot's current connected voice channel?
10 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
suavel.
suavel.OP3mo ago
TypeError: Cannot read properties of undefined (reading 'me')
TypeError: Cannot read properties of undefined (reading 'me')
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
suavel.
suavel.OP3mo ago
Pastebin
const { Guild, SlashCommandBuilder, Client } = require('discord.js'...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs3mo ago
Explaining <Class> and Class#method notation: learn more
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
suavel.
suavel.OP3mo ago
This was it. I was using the wrong prop when using it in the if statement Thank you Please excuse my 4 IQ
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server