yarik89
yarik89

Reputation: 1

Discord Bot (discord.js ^14) does not see direct messages

I have invited the bot to my server and it does see all messages typed over there. However, when I send it a DM, it does not react at all, even the event 'messageCreate' is not invoked.

const client = new Client({intents: [
  GatewayIntentBits.DirectMessages,
  GatewayIntentBits.DirectMessageReactions,
  GatewayIntentBits.DirectMessageTyping,
  GatewayIntentBits.Guilds,
  GatewayIntentBits.GuildMessages,
  GatewayIntentBits.MessageContent,
  GatewayIntentBits.GuildMembers,
]});


client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});


client.on('messageCreate', (message) => {
  console.log('Message received:', message.content); // prints all messages inside my server 
});

Maybe direct messages are handled by different event now? Can't find the newest information.

Upvotes: 0

Views: 51

Answers (1)

yarik89
yarik89

Reputation: 1

    const client = new Client({
  intents: [
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.DirectMessageReactions,
    GatewayIntentBits.DirectMessageTyping,
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
  ],
  'partials': [Partials.Channel]
});

Upvotes: 0

Related Questions