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

217
Views
TypeError: no se puede leer la propiedad 'has' de undefined // Discord.js

Entonces, estaba creando un bot para mi servidor Discord. Y tengo este error. Por favor, recuerda que soy un aficionado :). Gracias de antemano, lo aprecio ^^.

 const config = require('../config.js'); module.exports = message => { let client = message.client; if (message.author.bot) return; if (!message.content.startsWith(config.prefix)) return; let command = message.content.split(' ')[0].slice(config.prefix.length); let params = message.content.split(' ').slice(1); let cmd; if (client.commands.has(command)) { cmd = client.commands.get(command); } else if (client.aliases.has(command)) { cmd = client.commands.get(client.aliases.get(command)); }; if (cmd) { if(!message.guild) { if(cmd.config.guildOnly === true) { return; }; }; if (cmd.config.permLevel) { if(cmd.config.permLevel === "BOT_OWNER") { if(!config.geliştiriciler.includes(message.author.id)) { message.channel.send(`Bu komutu kullanabilmek için \`${cmd.config.permLevel}\` yetkisine sahip olmalısın.`).then(msg => msg.delete({timeout: 3000})); return; } } if(!message.member.hasPermission(cmd.config.permLevel)) { message.channel.send(`Bu komutu kullanabilmek için \`${cmd.config.permLevel}\` yetkisine sahip olmalısın.`).then(msg => msg.delete({timeout: 3000})); return; }; }; cmd.run(client, message, params); }; };
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

En la línea 7, intente esto

 const cmd = message.client.commands.get(command) || message.client.commands.find( (cmd) => cmd.aliases && cmd.aliases.includes(command) // if you're also using aliases ); if (!command) return;
about 4 years ago · Juan Pablo Isaza Report

0

Agregue algunos valores booleanos para verificar si client.commands/client.aliases no está definido.

 if (client.commands && client.commands.has(command)) { cmd = client.commands.get(command); } else if (client.aliases && client.aliases.has(command)) { cmd = client.commands.get(client.aliases.get(command)); };
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!