Browse Source

Use await to fix undefined server count

master
Abheek Dhawan 4 years ago
parent
commit
2ed7f28f99
  1. 8
      bot.js

8
bot.js

@ -122,17 +122,17 @@ client.on("message", async message => {
async function aboutBot(message) { async function aboutBot(message) {
const uptimeDays = client.uptime / 86400000; const uptimeDays = client.uptime / 86400000;
let guildCount; let serverCount;
client.shard.fetchClientValues('guilds.cache.size') await client.shard.fetchClientValues('guilds.cache.size')
.then(results => { .then(results => {
guildCount = results.reduce((acc, guildCount) => acc + guildCount, 0); serverCount = results.reduce((acc, guildCount) => acc + guildCount);
}) })
.catch(console.error); .catch(console.error);
const aboutBotEmbed = new Discord.MessageEmbed() const aboutBotEmbed = new Discord.MessageEmbed()
.setTitle("About me!") .setTitle("About me!")
.setURL(`https://adat.link/awesomemod`) .setURL(`https://adat.link/awesomemod`)
.setAuthor(client.user.tag, client.user.avatarURL()) .setAuthor(client.user.tag, client.user.avatarURL())
.addField(`Servers`, guildCount, true) .addField(`Servers`, `${serverCount}`, true)
.addField(`Uptime`, `${uptimeDays.toFixed(1)} days`, true) .addField(`Uptime`, `${uptimeDays.toFixed(1)} days`, true)
.addField(`Invite Link`, `Click the title to add this bot to your server!`) .addField(`Invite Link`, `Click the title to add this bot to your server!`)
.setFooter(`Client ID: ${client.user.id}`) .setFooter(`Client ID: ${client.user.id}`)

Loading…
Cancel
Save