client.channels.cache.get(channelId) returning undefined
Hello, I'm unsure why a specific message is returning undefined from a channel. Could use another set of eyes since I've been staring for so long.
25 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!message ids are strings
I'll give that a try, thank you!
np
Still coming up as undefined
send your code again
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
oh sorry I copy pasted above
yeah they're strings now
can you send the updated code
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
the variable for message is returning as undefined, so it's not able to find the message with the specific id
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I'll give that a try 🙂
am I using this right? I'm still getting undefined
oh hang on this is a different error
Does this mean the client channel is reading as undefined?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
okay so I was able to get that working using fetch.
For some reason I'm having a similar issue using it later down the line as well trying to get the members.
Throws the error:
https://old.discordjs.dev/#/docs/discord.js/14.13.0/class/GuildMemberManager?scrollTo=fetch
Says it should be returning a collection
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
I should also mention that this method is failing as well
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
oh okay that actually makes a lot more sense.
What's a good way to access the guild from the discord client?
I would assume client.guild?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I appreciate you Jo! You were helpful when I was first learning JS and you're still amazing today. Thanks homie
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View