message.content doesn’t have any value in Discord.js

Make sure you enable the message content intent on your developer portal and add the GatewayIntentBits.MessageContent enum to your intents array.

Applications ↦ Settings ↦ Bot ↦ Privileged Gateway Intents

enter image description here

You’ll also need to add the MessageContent intent:

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

If you’re using discord.js v13, you’ll need to enable the message content intent on your developer portal and if your bot uses the Discord API v10, you will need to add the MESSAGE_CONTENT flag to your intents:

const client = new Client({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.MESSAGE_CONTENT,
  ],
});

Leave a Comment