messageCreate not working with DMs

Greetings! I'm having troubles getting the messageCreate event to run with DMs. When I send a server message it all works well, but in DMs it simply refuses to work. listeners/messageCreate.ts:
import { ApplyOptions } from '@sapphire/decorators';
import { Listener } from '@sapphire/framework';
import { Events, Message } from 'discord.js';

@ApplyOptions<Listener.Options>({
event: Events.MessageCreate,
})
export class MessageCreateListener extends Listener {
public async run(message: Message) {
console.log('test');
// ...
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Listener } from '@sapphire/framework';
import { Events, Message } from 'discord.js';

@ApplyOptions<Listener.Options>({
event: Events.MessageCreate,
})
export class MessageCreateListener extends Listener {
public async run(message: Message) {
console.log('test');
// ...
}
}
Intents in client constructor:
intents: [
IntentBits.Guilds,
IntentBits.GuildMembers,
IntentBits.GuildMessages,
IntentBits.DirectMessages,
IntentBits.MessageContent,
],
intents: [
IntentBits.Guilds,
IntentBits.GuildMembers,
IntentBits.GuildMessages,
IntentBits.DirectMessages,
IntentBits.MessageContent,
],
I've also tripled checked whether the message intent is enabled in developer dashboard
4 Replies
Favna
Favna13mo ago
Enable the channel partial in your client options https://old.discordjs.dev/#/docs/discord.js/main/typedef/Partials
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Favna
Favna13mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Favna
Favna13mo ago
And as the links above show, this is discordjs related. Not sapphire.
Vedinsoh
Vedinsoh13mo ago
That did the trick, thanks! I didn't know what the exact problem was so I wasn't sure whether to post here or elsewhere, apologies
Want results from more Discord servers?
Add your server
More Posts