Compare commits

...

4 commits

7 changed files with 71 additions and 9 deletions

View file

@ -110,7 +110,22 @@ const aboutServer = function (c) {
},
{
text: thisItem,
color: c.colors.primary
color: c.colors.primary,
clickEvent: {
action: "copy_to_clipboard",
value: thisItem
},
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
},
value: { // Added twice for backwards compatibility
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
}
}
}
]
})
@ -187,9 +202,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: [
{
@ -198,7 +215,22 @@ const displayServerList = function (c) {
},
{
text: `${item.host.host}:${item.host.port}`,
color: c.colors.primary
color: c.colors.primary,
clickEvent: {
action: "copy_to_clipboard",
value: `${item.host.host}:${item.host.port}`
},
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
},
value: { // Added twice for backwards compatibility
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
}
}
}
]
})
@ -207,13 +239,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

@ -2,6 +2,13 @@ const { languages, getMessage } = require('../util/lang.js')
const fs = require('fs')
module.exports = {
execute: (c) => {
if(c.type == "console"){
c.reply({
text: getMessage(c.lang, 'command.settings.disabled.console'),
color: c.colors.secondary
})
return
}
const subcmd = c.args.splice(0, 1)[0]
switch (subcmd) {
case 'set':{

View file

@ -12,7 +12,22 @@ module.exports = {
},
{
text: item,
color: c.colors.primary
color: c.colors.primary,
clickEvent: {
action: "copy_to_clipboard",
value: item
},
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
},
value: { // Added twice for backwards compatibility
text: getMessage(c.lang, 'copyText'),
color: c.colors.secondary
}
}
}
]
}

View file

@ -16,6 +16,6 @@ module.exports = {
]
})
},
aliases: ['validate'],
aliases: ['verify'],
level: 1
}

View file

@ -64,6 +64,7 @@
"command.help.noCommand": "Command does not exist",
"command.help.alias": "Alias to %s",
"command.netmsg.disabled": "This command has been disabled on this server.",
"command.settings.disabled.console": "This command cannot be run from the console.",
"command.settings.get.colorPrimary": "Primary color",
"command.settings.get.colorSecondary": "Secondary color",
"command.settings.get.language": "Language",
@ -108,6 +109,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'