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

87
Views
¿Cómo funciona la dosis de bot.on('messageCreate') discord.js? el bot no detectará un mensaje enviado, tratando de hacer un bot de chat de discordia

costos y requisitos

 require('dotenv').config(); const OpenAI = require('openai-api'); // Load your key from an environment variable or secret management service // (do not include your key directly in your code) const OPENAI_API_KEY = process.env.OPENAI_API_KEY; const openai = new OpenAI(OPENAI_API_KEY); const Discord = require('discord.js'); const TOKEN = process.env.TOKEN; const { Client, Intents } = require('discord.js'); const bot = new Discord.Client({ intents: [Intents.FLAGS.GUILDS] }); const prefix = 'w!'; *on ready* bot.on('ready', async() => { console.log(`${bot.user.tag} is online!`); bot.user.setActivity('with the code', {type: 'PLAYING'}); });

este es el problema, no detectará los mensajes enviados. Probé de diferentes maneras pero nada, no tiene nada que ver con los permisos del servidor. Estoy probando en un servidor en blanco y el nodo está actualizado.

 bot.on('messageCreate', message => { if (message.content === 'ping') { message.channel.send('pong'); } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para que se active el evento messageCreate , debe tener habilitada la intención del cliente DIRECT_MESSAGES .

 const bot = new Discord.Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES] });

Lea más sobre las intenciones aquí

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!