mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
add approx install count
This commit is contained in:
parent
f99efdf813
commit
775edf5202
1 changed files with 22 additions and 4 deletions
|
@ -7,6 +7,8 @@ const { editOrReply } = require('#utils/message');
|
||||||
// TODO: Turn this into a general purpose permissions constant
|
// TODO: Turn this into a general purpose permissions constant
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
const superagent = require("superagent");
|
||||||
|
|
||||||
// TODO: Move this into utils
|
// TODO: Move this into utils
|
||||||
function format(seconds){
|
function format(seconds){
|
||||||
function pad(s){
|
function pad(s){
|
||||||
|
@ -61,8 +63,24 @@ 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} `)}`
|
||||||
|
]
|
||||||
|
|
||||||
|
if(applicationMetadata?.body?.approximate_user_install_count) display.push(
|
||||||
|
`${iconPill("user", "Installations")} ${highlight(` ${applicationMetadata?.body?.approximate_user_install_count} `)}`
|
||||||
|
)
|
||||||
|
|
||||||
|
display = [
|
||||||
|
...display
|
||||||
`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`,
|
`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`,
|
||||||
`${iconPill("latency", "Memory Usage ")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`,
|
`${iconPill("latency", "Memory Usage ")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`,
|
||||||
`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`,
|
`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue