#TypeError Cannot read properties of undefined (reading 'setChannel')

13 messages · Page 1 of 1 (latest)

reef aurora
#

• 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.

orchid junco
#

oops meant to edit

#

heres the code

#

on the bottom; i dont know exactly how to set it up from an interaction

thin pine
#

how are you creating the channel?

orchid junco
thin pine
#

const member = await guildId.members.fetch(interaction.user)
member.voice.setChannel(…)

#

also it would be good to rename guildId to guild

#

because it’s a Guild object not a guild id

orchid junco
#

yeah, my variables are a little bit all over the place and guild/guildId were swapped, just wanted to make sure everything worked before i cleaned it up. It ended up working though, thank you so much!

thin pine
#

no prob

orchid junco
#

oh btw, how would you go by making sure someone is actually IN any or specific vc in the server, so that if they try to run the command without being in one it throws an error. maybe by .catch?