Add serverlist to about command

This commit is contained in:
7cc5c4f330d47060 2024-08-13 02:08:23 -04:00
parent 58df0b2b6a
commit 58b94697bb
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
2 changed files with 25 additions and 0 deletions

View file

@ -4,6 +4,7 @@ const { getMessage, formatTime } = require('../util/lang.js')
const fs = require('fs')
const botVersion = require('../util/version.js')
const version = require('../version.json')
const index = require('../index.js')
const aboutBot = function (c) {
c.reply({
@ -178,10 +179,33 @@ const aboutServer = function (c) {
return botVersion
})
}
const displayServerList = function (c) {
for(const i in index.bot){
if(index.bot[i].host.options && index.bot[i].host.options.hidden) continue
c.reply({
translate: getMessage(c.lang, 'command.about.serverListItem'),
color: c.colors.secondary,
with:[
{
text: i.toString(),
color: c.colors.primary
},
{
text: `${index.bot[i].host.host}:${index.bot[i].host.port}`,
color: c.colors.primary
}
]
})
}
}
module.exports = {
execute: function (c) {
if (c.args[0] === 'server') {
aboutServer(c)
} else if (c.args[0] === 'serverlist') {
displayServerList(c)
} else {
aboutBot(c)
}

View file

@ -88,6 +88,7 @@
"command.about.serverInfo.os.android.model": "Device model",
"command.about.serverInfo.botName": "Bot name",
"command.about.serverInfo.botVer": "Bot version",
"command.about.serverListItem": "Server %s - %s",
"command.tpr.success": "Teleporting %s to %s, %s, %s",
"command.verify.success": "Successfully verified with permission level %s",
"command.error": "An error occured (check console for more info)",