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

220
Views
Estoy tratando de hacer comandos anidados en mi command_handler.js discord.js

Estoy tratando de crear comandos anidados en discord.js para que mi bot lea subcarpetas en mi carpeta de comandos (discord.js) Todo está básicamente en el título

manejador_de_comandos.js:

 const fs = require('fs') module.exports = (client, Discord) => { const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')) for (const file of command_files) { const command = require(`../commands/${file}`); if (command.name) { client.commands.set(command.name, command); } else { continue; } } }

La mayor parte de Index.js:

 const Discord = require('discord.js'); const client = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION" ]}); const token = process.env['DISCORD_TOKEN'] const fs = require('fs'); client.commands = new Discord.Collection(); client.events = new Discord.Collection(); ['command_handler', 'event_handler'].forEach(handler => { require(`./handlers/${handler}`)(client, Discord); }) // Command Handler 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.login token client.login(token)

Gracias por adelantado

about 4 years ago · Santiago Gelvez
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!