Bot not receiving DM's

This is my bots code.
console.log(message)
// If the message is from a bot, do nothing
if (message.author.bot) return;
if (message.channel.type !== 1) return;
console.log('Channel type:', message.channel.type, packages.Discord.ChannelType.DM);
console.log(message)
// If the message is from a bot, do nothing
if (message.author.bot) return;
if (message.channel.type !== 1) return;
console.log('Channel type:', message.channel.type, packages.Discord.ChannelType.DM);
It doesnt log anything when the message is in the dms but it does when when its sent in a guild. In my bot.js I have
const Client = new packages.Discord.Client({
intents: configs.ClientIntents()
})
const Client = new packages.Discord.Client({
intents: configs.ClientIntents()
})
With the ClientIntents() being
function ClientIntents() {
const intents = Object.keys(packages.Discord.GatewayIntentBits).map((key) => {
return packages.Discord.GatewayIntentBits[key];
})


console.log(intents)

return intents;
}
function ClientIntents() {
const intents = Object.keys(packages.Discord.GatewayIntentBits).map((key) => {
return packages.Discord.GatewayIntentBits[key];
})


console.log(intents)

return intents;
}
Also no errors come
7 Replies
d.js toolkit
d.js toolkitβ€’2mo 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! - βœ… Marked as resolved by OP
Navin
NavinOPβ€’2mo ago
Ping me if you have a response
d.js docs
d.js docsβ€’2mo ago
We highly recommend only specifying the intents you actually need. - Note, that 98303, 32767 or whatever other magic number you read that represents "all intents", gets outdated as soon as new intents are introduced. - The number will always represent the same set of intents, and will not include new ones. There is no magic "all intents" bit. To receive direct message events on "messageCreate" with your bot, you will need: - The DirectMessages gateway intent - The Channel partial setting
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Navin
NavinOPβ€’2mo ago
Ik that part, I just have all of them for now
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Navin
NavinOPβ€’2mo ago
Thank you so much @JΓΆπŸŒˆπŸ¦„ , It was the partial that was missing.
Want results from more Discord servers?
Add your server