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

136
Views
Comando que puede funcionar con y sin etiquetar a alguien

Estoy buscando una manera de tener un comando que dé diferentes respuestas dependiendo de si ha etiquetado a alguien junto con el comando.

Esto es lo que tengo hasta ahora:

 module.exports = { name: 'attack', description: "uses attack embed", execute(message, args, Discord) { var newEmbed = new Discord.MessageEmbed() .setColor('#A5775C') .setDescription(message.author.username + ' *attacked* '+ message.mentions.members.first().username); var newEmbed1 = new Discord.MessageEmbed() .setColor('#A5775C') .setDescription(message.author.username + ' *attacked the enemy!*'); if (message.mentions.members.first()) { message.channel.send({embeds: [newEmbed]}); }else{ message.channel.send({embeds: [newEmbed1]}); } } }

Cuando pruebo este formato, el comando en el que haces ping a alguien funciona, pero cuando no haces ping a alguien, no pasa nada.

Gracias por la ayuda.

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

0

Pruebe este código, requiere menos código y buscará un objetivo.

 let target if (message.mentions.members.first() === undefined) { target = 'the enemy.' } else { target = message.mentions.members.first().username } const newEmbed = new Discord.MessageEmbed() .setColor('#A5775C') .setDescription(`${message.author} attacked ${target}`) message.channel.send({ embeds: [newEmbed] })
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!