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

122
Views
¿Cómo invito a alguien a un gremio en discord.js?

Estoy tratando de hacer que mi bot de Discord envíe un mensaje a un usuario con un enlace para unirse al gremio, pero tengo problemas con a quién enviarlo. Como no están en el gremio, no puedes enviarles mensajes.

 if (!args[0]) return message.reply("Who would you like to invite? For example: funny#6942"); message.channel.createInvite({ unique: true, maxUses: 1, maxAge: 8 * 60 * 1000 }) .then(invite => { var invited = args[0]; message.invited.send("https://discord.gg/" + invite.code); //dm person with the invite code });

Todavía soy algo nuevo en la API de JavaScript de Discord.

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

0

Puede buscar ese usuario en todos los usuarios almacenados en caché como en

 client.users.cache.find((x) => { x.tag == `${args[0]}` }).send("https://discord.gg/" + invite.code); // This would return a GuildMember object and send the code to that person

Puede haber instancias en las que el usuario no esté en caché, en esos casos, es mejor pedirle una Id al usuario y usar <Client>#user#fetch() en ellos, aunque si su bot es pequeño, ¡no hay necesidad de preocuparse! 😄

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!