rely on built-in application install metadata

This commit is contained in:
bignutty 2024-12-27 00:02:47 +01:00
parent 4bdf0459bd
commit 8ceba51a30

View file

@ -62,21 +62,10 @@ module.exports = {
formatted.usage += cstats.usage formatted.usage += cstats.usage
} }
let applicationMetadata;
try{
applicationMetadata = await superagent.get(`https://canary.discord.com/api/v9/applications/${context.client.user.id}`)
.set({
"Authorization": "Bot " + context.client.token
})
}catch(e){}
const display = [ const display = [
`${iconPill("home", "Servers ")} ${highlight(` ${formatted.guilds} `)}` `${iconPill("home", "Servers ")} ${highlight(` ${formatted.guilds} `)}`
] ]
display.push(`${iconPill("user", "Installations")} ${highlight(` ${context.client.application.approximateUserInstallCount} `)}`)
if(applicationMetadata.body?.approximate_user_install_count)
display.push(`${iconPill("user", "Installations")} ${highlight(` ${applicationMetadata.body.approximate_user_install_count} `)}`)
display.push(`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`) display.push(`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`)
display.push(`${iconPill("latency", "Memory Usage ")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`) display.push(`${iconPill("latency", "Memory Usage ")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`)
display.push(`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`) display.push(`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`)