#Issue with getting Message author
27 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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 OP
Your code and error do not match
yes but your error tells you you use fetch somewhere
Which you don't
also not all messages are cached
TypeError: Cannot read properties of undefined (reading 'author')
at Object.execute (/home/container/src/commands/report.js:18:47)
at async Client.<anonymous> (/home/container/index.js:61:3)
only 1 message needs to get cached and it is cached
the last error indicates it isnt
The message cache doesn’t fill up because you …cache.get() it
You’ll need to fetch the message
Which bare in mind also checks the cache as well, for a singular fetch
await <TextChannel>.messages.fetch(messageId)
oh thanks, I'll try and let you know ^^
I cannot use .username or .displayAvatarURL in message.author
Code
You didn’t resolve the promise
Resources to understand Promise:
- MDN: learn more
- Guide: learn more
- JavaScript info: learn more
ah yeah, I forgot that XD