Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda