Somehow getVoiceConnection(guildId) returns undefined
Well, as the title already says, Somehow
getVoiceConnection(guildId)
returns undefined.
I'm following this tutorial: https://youtu.be/oRWAuXqCuYA?t=841 (Timestamp is where the function is used).
Node v16.14.2
discord.js v14.0.3
discordjs/voice v0.11.0Tomato6966
YouTube
How To Make An ADVANCED Discord Music Bot - #03 - VoiceConnections ...
How To Make A Discord Bot! Music bots are one of the most fun discord bots to code and maintain! In this video, we use all new discord js v13 code to create an amazing discord music bot with join, skip, queue, stop, filters, bassboost, nightcore, speed, slash Commands and Text Commands!. This is an advanced tutorial if you are having difficultie...
2 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.I just found out that the check for if it has permissions doesn't seem to work. It then wants to output an error message but that message uses the
oldConnection
variable and therefor fails to send the message. So my actual issue is the checking for permission.
Code:
Thought so... It recognized "Permissions" as class in VSC but now I'm looking in the docs and can't find a permission class in v14. Found the PermissionsBitField you just wrote
Yeah, so this worked perfectly now. Thank you. I'm just asking myself if the error messages make sense then... Because if oldConnection
is the connection the bot has right now, it will always be undefined if the bot can't join, meaning the error message will never show up like this...
Ok, I'm just dumb. I actually implemented that part and I wasn't thinking right. Thanks for your help!