From 58b94697bbe10b9df037b8d59fb4ff3869e5b2b9 Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 Date: Tue, 13 Aug 2024 02:08:23 -0400 Subject: [PATCH] Add serverlist to about command --- commands/about.js | 24 ++++++++++++++++++++++++ lang/en-US.json | 1 + 2 files changed, 25 insertions(+) diff --git a/commands/about.js b/commands/about.js index 96a5e9d..22a8487 100644 --- a/commands/about.js +++ b/commands/about.js @@ -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) } diff --git a/lang/en-US.json b/lang/en-US.json index 50c8b31..d0dd80f 100644 --- a/lang/en-US.json +++ b/lang/en-US.json @@ -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)",