#How to get message by id
23 messages · Page 1 of 1 (latest)
• 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.
- First,
console.log(await ...)notawait console.log(...) - Second,
channelisn't a array, - Third, not all channels have messages
ok
thx
the channel has messages
and channel is an array
and its not working 😦
@unreal pike
I'm pretty sure the channels from the interaction.guild.channels.cache isn't a array, is a GuildChannel
Send you full code
Passing a channel Id to the guilds resolve is suported?
Also do not spoonfeed code, #rules 5
oops my bad
havent really tested but the idea is there. cache is kinda unreliable so fetching from guild to channel to message works
it's slower but more reliable
Nah, it will be slower if the message isn't in cache, djs checks the cache before fetching, you are absolutely right 🙂
do you have a reference on how much data does the different caches contain?
something that i can read
thank you in advance
channel is actually an array of [channelId, channel] since you iterate over the map's entries, if you don't need the keys you can iterate over values() instead
that said, trying to fetch a message from each channel can get quite API spammy, wherever you obtained the message id you should also save the channel id and fetch only from this channel
My bad