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

114
Views
No se pueden leer las propiedades de undefined (leyendo miembros)

Estoy tratando de crear un comando de inserción que incluirá al usuario en él, pero cada vez que intento ejecutarlo, aparece un error sobre la lectura de members y no estoy seguro de cómo solucionarlo.

 const Discord = require('discord.js') module.exports = { name: 'giveaway', description: 'sends giveaway info', execute(client, message, args) { const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]); if(!args[0]) return message.channel.send('Please specify a user'); if(!member) return message.channel.send('I can\'t seem to find this user.') const gaembed = new Discord.MessageEmbed() .setTitle('Congratulations', member) .setColor('GREEN') .setFooter('You have 24 hours from this message to claim your prize.') .setTimestamp() .setDescription('Congratulations! You have won a prize! Be sure to DM <@myuserid> to claim it, before it is rerolled.') message.channel.send(gaembed); }, };

Este es el controlador de comandos en mi archivo index :

 client.on('message', message => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(' '); const commandName = args.shift().toLowerCase(); const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); if(!command) return; try { command.execute(message, args, client) } catch (error) { console.error(error); message.reply('There was an error trying to execute that command! Check the console for more details!'); } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Es necesario corregir el orden de los argumentos:

 // wrong execute(client, message, args) {

debería ser esto:

 // correct execute(message, args, client) {

Como en su archivo de índice, lo llama con argumentos en este orden ( command.execute(message, args, client) ).

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!