Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
Discord "messageCreate" and "InteractionCreate" events does not work

I was trying to do a simple command using the clasic message event (now messageCreate event), so I programed a small code to test if the event is working righfully:

const Discord = require('discord.js')
const { Client, Intents, Message, MessageEmbed} = require('discord.js');
const { token, prefix } = require('./config.json')


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

client.once('ready', () => {
    console.log(`${client.user.username} Se Ha Conectado Correctamente`)
})

client.on('messageCreate', (message) => {
    console.log('Un Mensaje! :D');
    console.log(message);
})
client.on('interactionCreate', interaction => {
    console.log(interaction);
})

client.login(token);

But when I send the messages at the guild where I am testing the bot, he can't detect them for some reason.

as extra data, the console.log of the ready event works perfectly.

Fixes testings

Maybe permissions? It already have administrator but I moved the role to the top for testing, nothing happened.

Maybe add the GUILD_MESSAGES intent on the client? I also tried this one but the bot still can't detect the messages

Discord.js version: v13.3.1
Node.js version: v17.0.1
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Like Worthly Alpaca has mentioned in the comments, it is required to use the GUILD_MESSAGES intent in order to be able to receive the messages. Your client will now look like:

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

Please note that you now have to enable the GUILD_MESSAGES intent on the page of your Discord application.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda