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

452
Views
El bot discord.js no responde a los comandos

Estoy siguiendo un tutorial en YouTube: cómo codificar un bot de Discord

(Soy muy nuevo en la codificación y quería comenzar en alguna parte, también necesitaba un bot).

El código funcionaba bien hasta que comencé a agregar algunos comandos más, como -play y -leave . Después de eso, el bot no responde a ningún comando.

Intenté cambiar los prefijos, comenzando desde cero, y simplemente copiando y pegando su código en el mío. El bot se conecta, pero es casi como si el código que lo hace responder no estuviera allí.

Aquí está mi código:

 const Discord = require('discord.js'); const client = new Discord.Client({ intents: [] }) const prefix = '-'; const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')) for(const file of commandFiles){ const command = require(`./commands/${file}`); client.commands.set(command.name, command); } client.once('ready', () => { console.log('SaltSounds Is Online!'); }); client.on('message', message =>{ if(!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase(); if(command === 'ping'){ message.channel.send('pong!') } }); client.login('my token');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Necesitas estos dos intents para recibir mensajes: GUILDS , GUILD_MESSAGES . Puedes implementarlo así

 const Discord = require('discord.js'); const { Intents } = Discord; const client = new Discord.Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] })
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!