From a31a4a237076b9fbc33fff69a8efd2d4fc58653f Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 Date: Fri, 23 Aug 2024 10:29:01 -0400 Subject: [PATCH] About command improvements --- commands/about.js | 16 +++++++++++----- lang/en-US.json | 1 + util/Command.js | 1 + util/ConsoleCommand.js | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/commands/about.js b/commands/about.js index df4c40f..5007617 100644 --- a/commands/about.js +++ b/commands/about.js @@ -187,9 +187,11 @@ const aboutServer = function (c) { const displayServerList = function (c) { index.bot.forEach((item, i)=>{ - if (item.host.options && item.host.options.hidden) return + if (item.host.options && item.host.options.hidden && c.verify !== 3 && c.bot.id !== i) return + let message = 'command.about.serverListItem'; + if(c.bot.id == i) message = 'command.about.serverListItem.thisServer' c.reply({ - translate: getMessage(c.lang, 'command.about.serverListItem'), + translate: getMessage(c.lang, message), color: c.colors.secondary, with: [ { @@ -207,13 +209,17 @@ const displayServerList = function (c) { module.exports = { execute: function (c) { - if (c.args[0] === 'server') { + let subcmd = c.args[0] + if(subcmd === "servers") subcmd = "serverlist" + if(c.cmdName === "serverinfo") subcmd = "server" + if(c.cmdName === "serverlist" || c.cmdName === "servers") subcmd = "serverlist" + if (subcmd === 'server') { aboutServer(c) - } else if (c.args[0] === 'serverlist') { + } else if (subcmd === 'serverlist') { displayServerList(c) } else { aboutBot(c) } }, - aliases: ['info'] + aliases: ['info', 'serverlist', 'servers', 'serverinfo'] } diff --git a/lang/en-US.json b/lang/en-US.json index aab09f4..7d46c6b 100644 --- a/lang/en-US.json +++ b/lang/en-US.json @@ -108,6 +108,7 @@ "command.about.serverInfo.botName": "Bot name", "command.about.serverInfo.botVer": "Bot version", "command.about.serverListItem": "Server %s - %s", + "command.about.serverListItem.thisServer": "Server %s - %s (this server)", "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)", diff --git a/util/Command.js b/util/Command.js index 3921b7a..8ef2247 100644 --- a/util/Command.js +++ b/util/Command.js @@ -12,6 +12,7 @@ class Command { this.bot = bot this.type = 'minecraft' this.args = cmd.split(' ').slice(1) + this.cmdName = cmd.split(' ')[0] this.verify = verify this.host = bot.host.host this.port = bot.host.port diff --git a/util/ConsoleCommand.js b/util/ConsoleCommand.js index f062f23..4664ab7 100644 --- a/util/ConsoleCommand.js +++ b/util/ConsoleCommand.js @@ -16,6 +16,7 @@ class ConsoleCommand { : {} this.type = 'console' this.args = cmd.split(' ').slice(1) + this.cmdName = cmd.split(' ')[0] this.verify = 3 this.host = '' this.port = '3'