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

202
Views
Quiero crear subcarpetas de comando. Pero mi bot no lee los comandos dentro de las carpetas. No hay error. Por favor ayuda, este es mi controlador de comandos.

const fs = require('nodo:fs'); const Discord = require('discord.js')

 module.exports = (client) => { client.commands = new Discord.Collection(); const commandFolders = fs.readdirSync('./commands') const commands = []; for (const folder of commandFolders) { const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for (const file of command_files) { const command = require(`../commands/${folder}/${file}`); client.commands.set(command.name, command); } }

}

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Necesita adaptar sus argumentos readdirSync

 const command_files = fs.readdirSync('./commands/' + folder);

Esto le dará todos sus archivos. Entonces necesitas:

 for (const file of command_files) { const command = require('./commands/' + folder + '/' + file); client.commands.set(command.name, command); }
about 4 years ago · Juan Pablo Isaza Report

0

const command_files = fs.readdirSync(`./commands/${folder}`).filter(file => file.endsWith('.js'));
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!