Search code examples
node.jsdiscord.js

Discord.js not getting message content


I'm trying to get the message content of the messages sent in my server and the bot only returns a blank character. Does anyone know how to fix this?

Code

client.on('messageCreate', async (message) => {
  console.log(message.content)
});

Message

enter image description here

Console print

enter image description here


Solution

  • I'm not sure but I think you forgot to include the new MessageContent Intent.
    You have to add it to the intents array on your Client instance like I have on mine:

    my discord bot intents