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

329
Views
Discord.js command.name.toLowerCase() no funciona

Estoy trabajando en discord.js bot V13 y encontré este error

Código:

 client.commands = new Discord.Collection(); const cooldowns = 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.toLowerCase(), command);//Errors at command.name.toLowerCase() }

Ayuda con: solo quiero convertir la cadena (command.name.toLowerCase()) pero envía un error que también probé en VScode pero envía un error, también el error es el mismo Error:

TypeError: no se puede leer la propiedad 'toLowerCase' de undefined

Cualquier información por favor no dude en preguntar.

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

0

Usa .toLowerCase() en tu evento

P.ej:

 client.on("messageCreate", async message =>{ if(!message.content.startsWith(prefix)) return; const args = message.content.slice(prefix.length).trim().split(' ') const cmd = args[0].toLowerCase() const command = client.commands.get(cmd) if(!command) return; try{ await command.execute(message, args) } catch(e){ console.log(e) } })
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!