mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
Merge branch 'main' of https://gitlab.com/bignutty/labscore
This commit is contained in:
commit
cb1fcf9935
1 changed files with 21 additions and 7 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,15 +63,27 @@ 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} `)}`
|
||||||
`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`,
|
|
||||||
`${iconPill("latency", "Memory Usage")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`,
|
|
||||||
`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`,
|
|
||||||
``,
|
|
||||||
`${iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code')} ${iconLinkPill('link', context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }), `Invite ${context.client.user.username}`).replace("ptb.discordapp.com","discord.com")}`
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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("latency", "Memory Usage ")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`)
|
||||||
|
display.push(`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`)
|
||||||
|
display.push(``)
|
||||||
|
display.push(`${iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code')} ${iconLinkPill('link', context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }), `Invite ${context.client.user.username}`).replace("ptb.discordapp.com","discord.com")}`)
|
||||||
|
|
||||||
return editOrReply(context, createEmbed("default", context, {
|
return editOrReply(context, createEmbed("default", context, {
|
||||||
description: display.join('\n')
|
description: display.join('\n')
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue