message event listener not working properly

In discord.js v13, it is necessary to specify an intent in new discord.Client(). Events other than the specified intent will not be received.
ClientOptions
Intents#FLAGS

To receive the message event, you will need the GUILDS and GUILD_MESSAGES intents.

You mean…

const client = new Discord.Client({
    partials: ['MESSAGE', 'CHANNEL', 'REACTION'],
    intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES]
});

Or to receive all (including privileged intent) events…

const client = new Discord.Client({
    partials: ['MESSAGE', 'CHANNEL', 'REACTION'],
    intents: Object.keys(Discord.Intents.FLAGS)
});

Also, in discord.js v13, the message event has been deprecated, so it is recommended to replace it with messageCreate.

- client.on('message', async message => {
+ client.on('messageCreate', async message => {

Leave a Comment