Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!