About command improvements

This commit is contained in:
7cc5c4f330d47060 2024-08-23 10:29:01 -04:00
parent 27ec2a3f0f
commit a31a4a2370
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
4 changed files with 14 additions and 5 deletions

View file

@ -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']
}

View file

@ -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)",

View file

@ -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

View file

@ -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'