client.channels.cache.get(channelid) returning undefined
Attempting to send a message to channels using the channel id. However, client.channels.cache.get(channelid) keeps returning undefined and client.channels.fetch(channelid).send(message) results in the following error: . Any advice?
9 Replies
- 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 OPwhere are you trying to do this? in index.js?
just saying
client.(the rest)
won't work as you need to specify the guild
you can use interaction.guild.channels.cache.get(id)
if you want to get it where you have access to a CommandInteraction
in a guild
just doing client.channels
doesn't work because you're not specifying a serverI am not doing it as a return of an interaction. It is a timed event.
can you send the full code then?
not just the line
oh uh
Nvm. Got it to respond this time.
not the whole file
alrighty
has the issue rearised
No, it has not. This was the solution for me.