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

159
Views
Cómo contar todos los miembros de gremios discord.js v12

¡Así que esa es la forma de contar a todos los miembros del gremio en un mensaje!

 const math = require('mathjs'); const guildCount = client.guilds.cache.map(g => g.memberCount); const reslut = math.evaluate(guildCount.join("+")); message.channel.send(`Your Bot serve: \`${reslut}\` Member!`)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Bueno, su código agrega el memberCountz of each guild to the variable, but you are using the variable for the sum, which contains nothing since your devolución de llamada .map` no devuelve nada.

Así que tampoco

 const math = require('mathjs'); const guildCount = client.guilds.cache.map(g => {return g.memberCount}); const result = math.evaluate(guildCount.join("+")); message.channel.send(`Your Bot serve: \`${result}\` Member!`)

o

 const math = require('mathjs'); const cal = []; const guildCount = client.guilds.cache.forEach(g => {cal.push(g.memberCount)}); const result = math.evaluate(cal.join("+")); message.channel.send(`Your Bot serve: \`${result}\` Member!`)

Pero puede hacer la suma con una simple reducción , sin necesidad de un paquete adicional.

 const result = client.guilds.cache.reduce((total, guild) => sum + guild.memberCount, 0); message.channel.send(`Your Bot serve: \`${result}\` Member!`)
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!