#Issue with getting Message author

27 messages · Page 1 of 1 (latest)

plucky plinth
#

Error:

TypeError: Cannot read properties of undefined (reading 'fetch')
    at Object.execute (/home/container/src/commands/report.js:16:17)
    at async Client.<anonymous> (/home/container/index.js:61:3)

Code: https://sourceb.in/cIZnGcjK6A

sonic cairnBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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
modern dust
#

Your code and error do not match

plucky plinth
#

What do you mean?

#

I get that error from that file

modern dust
#

yes but your error tells you you use fetch somewhere

#

Which you don't

#

also not all messages are cached

plucky plinth
#

huh

#

I'm trying again

plucky plinth
plucky plinth
modern dust
#

the last error indicates it isnt

plucky plinth
#

Well, what could cause that?

#

You can see in the code that i cached it

astral quarry
#

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)

plucky plinth
plucky plinth
#

I cannot use .username or .displayAvatarURL in message.author

astral quarry
#

Code

plucky plinth
#

line 18

astral quarry
#

You didn’t resolve the promise

keen ibexBOT
plucky plinth
#

ah yeah, I forgot that XD