How to get message by id

for(let channel of interaction.guild.channels.cache) await console.log(channel[1].messages.fetch(messageId)) does not works
8 Replies
d.js docs
d.js docs2y ago
• 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.
조아오
조아오2y ago
- First, console.log(await ...) not await console.log(...) - Second, channel isn't a array, - Third, not all channels have messages
RichtigJoJo
RichtigJoJo2y ago
ok thx the channel has messages and channel is an array and its not working 😦 @jpbm135
조아오
조아오2y ago
I'm pretty sure the channels from the interaction.guild.channels.cache isn't a array, is a GuildChannel
https://discord.com/channels/222078108977594368/1013740066327248946/1013786722678612038
Send you full code Passing a channel Id to the guilds resolve is suported? Also do not spoonfeed code, #rules 5
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
조아오
조아오2y ago
Nah, it will be slower if the message isn't in cache, djs checks the cache before fetching, you are absolutely right 🙂
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
조아오
조아오2y ago
My bad