Can‘t find message by id

I can‘t fetch a message by his id. The error: const clockInMessage = await user.messages.fetch(worker.clockInMessage); 3|segritude | ^ 3|segritude | TypeError: Cannot read properties of undefined (reading 'fetch')
6 Replies
d.js toolkit
d.js toolkit14mo ago
- 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!
Black_Wither
Black_WitherOP14mo ago
The user and the message id are correct
treble/luna
treble/luna14mo ago
A user doesnt have a messages property you have to call createDM, which returns a channel
Black_Wither
Black_WitherOP14mo ago
Even if some DMs have already been sent? So it would be?:
const dmChannel = user.createDM()
const message = dmChannel.messages.fetch(…)
const dmChannel = user.createDM()
const message = dmChannel.messages.fetch(…)
treble/luna
treble/luna14mo ago
Handle the promise
Black_Wither
Black_WitherOP14mo ago
Ah ok, thank you very much
Want results from more Discord servers?
Add your server