message.channel in DM's is null, is there a way to fill it?

As the title suggests the api doesn't send the channel in the payload for DM messages. Is there a way to fetch the channel so it isn't null in the message object?
16 Replies
d.js toolkit
d.js toolkit12mo 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.
Stqlth
Stqlth12mo ago
Also, note, I understand you can fetch the channel with the id, but this does not update the existing message object, and you can't set it since channel is read only
monbrey
monbrey12mo ago
If you have the Channel partial enabled you should be getting the partials Otherwise I'm surprised you're getting the event at all
Stqlth
Stqlth12mo ago
im sending the message and then I try and do message.channel
monbrey
monbrey12mo ago
Oh so it's the bots message in the DM?
Stqlth
Stqlth12mo ago
correct
monbrey
monbrey12mo ago
Hmm But then... where are you sending it to? The user?
Stqlth
Stqlth12mo ago
The user is setting up some information and I send a couple modals they can respond to
monbrey
monbrey12mo ago
I'm not sure why you need it populated on message, but try this
d.js docs
d.js docs12mo ago
method User#createDM() Creates a DM channel between the client and the user.
monbrey
monbrey12mo ago
Not sure why it's not being put in the cache
Stqlth
Stqlth12mo ago
I don't necessarily need it, but I have a seperate package to make collectors easier, and it takes in a message object, and then uses message.channel so I was looking for a way to populate it instead of doing a PR for the package
monbrey
monbrey12mo ago
Does that package use the same client?
Stqlth
Stqlth12mo ago
Yea
monbrey
monbrey12mo ago
message.channel is a getter I think, it just retrieves it from cache
Stqlth
Stqlth12mo ago
oh that's very nice, let me try and fetch it This is correct, thanks!