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 toolkit2y 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
StqlthOP2y 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
monbrey2y 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
StqlthOP2y ago
im sending the message and then I try and do message.channel
monbrey
monbrey2y ago
Oh so it's the bots message in the DM?
Stqlth
StqlthOP2y ago
correct
monbrey
monbrey2y ago
Hmm But then... where are you sending it to? The user?
Stqlth
StqlthOP2y ago
The user is setting up some information and I send a couple modals they can respond to
monbrey
monbrey2y ago
I'm not sure why you need it populated on message, but try this
d.js docs
d.js docs2y ago
method User#createDM() Creates a DM channel between the client and the user.
monbrey
monbrey2y ago
Not sure why it's not being put in the cache
Stqlth
StqlthOP2y 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
monbrey2y ago
Does that package use the same client?
Stqlth
StqlthOP2y ago
Yea
monbrey
monbrey2y ago
message.channel is a getter I think, it just retrieves it from cache
Stqlth
StqlthOP2y ago
oh that's very nice, let me try and fetch it This is correct, thanks!
Want results from more Discord servers?
Add your server