0

My discord.js version is 14.0.3.

I'm trying to make a feature that requires the message content, so I created a client.on('messageCreate') event:

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

But the console is sending empty ('') strings. Every message I receive has empty content.

I added intents and partials, but it didn't change anything.

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessages],
    partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});

How do I access the content of messages sent to servers?

Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57
VinceKaj
  • 335
  • 4
  • 13

1 Answers1

3

From October 25, 2021, accessing message content now requires enabling a new privilege intent.

Bot tab on the Discord Developer Portal showing the new message content intent

This setting needs to be enabled for bots to receive message content.

More info

VinceKaj
  • 335
  • 4
  • 13