Bot Not Seeing DMs

Hey all, Working w/ DJS 14.8.0 and Node 18.12.0 I've seen a few threads related to this but I'm pretty sure their answers are already implemented in my code and my bot still isn't logging DMs. Anybody feel up to tackling a problem? This is how I'm initializing my client (overkill, probably):
const client = new Client({
disableEveryone: false,
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.User
]
})
const client = new Client({
disableEveryone: false,
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.User
]
})
and this is a snippet of my messageCreate handler:
client.on("messageCreate", async (message) => {
// Check for DM
if (message.channel.type === ChannelType.DM) {
console.log("Got a DM")
if (message.content.includes("help")) {
console.log("Message includes help")
message.reply(helptext)
}
}
})
client.on("messageCreate", async (message) => {
// Check for DM
if (message.channel.type === ChannelType.DM) {
console.log("Got a DM")
if (message.content.includes("help")) {
console.log("Message includes help")
message.reply(helptext)
}
}
})
Several other parts of the messageCreate handler work perfectly fine. It just seems to be the DM portion that doesn't I have also tried message.channel.type === "dm" and similar, but no dice The Message Content Intent Privileged Gateway Intent is enabled on Discord Developer Portal so that can't be it ChatGPT is giving me outdated info so we're out of luck there too Any thoughts? Thanks!
2 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.
Brant Goings
Brant GoingsOP2y ago
Haha I went to look through the rest of the handler to make sure I could share and found that I'm returning on the first line if the message doesn't start with the command prefix... of course I overlooked that and now it triggers Thanks for nudging me in the right direction @qjuh!
Want results from more Discord servers?
Add your server