Make the name field in options useful (netmsg)
This commit is contained in:
parent
35486c19fe
commit
54eb048e0b
4 changed files with 31 additions and 19 deletions
|
@ -2,29 +2,39 @@ const { bot } = require('../index.js')
|
||||||
const { getMessage } = require('../util/lang.js')
|
const { getMessage } = require('../util/lang.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
if (c.bot.host && c.bot.host.options.hidden) {
|
let host = c.host
|
||||||
c.reply({
|
let port = c.port
|
||||||
text: getMessage(c.lang, 'command.netmsg.disabled'),
|
if(c.bot.host.options && c.bot.host.options.hidden){
|
||||||
color: c.colors.secondary
|
host = "localhost" // Makes hidden servers appear as localhost
|
||||||
})
|
port = "25565"
|
||||||
return
|
|
||||||
}
|
}
|
||||||
const json = {
|
const json = {
|
||||||
translate: '[%s] %s: %s',
|
translate: '[%s] %s: %s',
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
translate: '%s:%s',
|
text: c.serverName,
|
||||||
with: [
|
hoverEvent: {
|
||||||
{
|
action: "show_text",
|
||||||
text: c.host,
|
value: {
|
||||||
color: c.colors.primary
|
translate: '%s: %s:%s',
|
||||||
},
|
with: [
|
||||||
{
|
{
|
||||||
text: c.port + '',
|
text: getMessage(c.lang, "command.netmsg.serverAddress"),
|
||||||
color: c.colors.primary
|
color: c.colors.primary
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: host,
|
||||||
|
color: c.colors.primary
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: port + '',
|
||||||
|
color: c.colors.primary
|
||||||
|
}
|
||||||
|
],
|
||||||
|
color: c.colors.secondary
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
color: c.colors.secondary
|
color: c.colors.primary
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: c.username,
|
text: c.username,
|
||||||
|
@ -37,7 +47,6 @@ module.exports = {
|
||||||
color: 'white'
|
color: 'white'
|
||||||
}
|
}
|
||||||
bot.forEach(item => {
|
bot.forEach(item => {
|
||||||
if (item.host.options.hidden) return
|
|
||||||
item.tellraw('@a', json)
|
item.tellraw('@a', json)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
"command.help.noCommand": "Command does not exist",
|
"command.help.noCommand": "Command does not exist",
|
||||||
"command.help.alias": "Alias to %s",
|
"command.help.alias": "Alias to %s",
|
||||||
"command.netmsg.disabled": "This command has been disabled on this server.",
|
"command.netmsg.disabled": "This command has been disabled on this server.",
|
||||||
|
"command.netmsg.serverAddress": "Server Address",
|
||||||
"command.settings.disabled.console": "This command cannot be run from the console.",
|
"command.settings.disabled.console": "This command cannot be run from the console.",
|
||||||
"command.settings.get.colorPrimary": "Primary color",
|
"command.settings.get.colorPrimary": "Primary color",
|
||||||
"command.settings.get.colorSecondary": "Secondary color",
|
"command.settings.get.colorSecondary": "Secondary color",
|
||||||
|
|
|
@ -16,6 +16,7 @@ class Command {
|
||||||
this.verify = verify
|
this.verify = verify
|
||||||
this.host = bot.host.host
|
this.host = bot.host.host
|
||||||
this.port = bot.host.port
|
this.port = bot.host.port
|
||||||
|
this.serverName = bot.host.options.name
|
||||||
this.prefs = prefs
|
this.prefs = prefs
|
||||||
if (prefs.lang) {
|
if (prefs.lang) {
|
||||||
this.lang = prefs.lang
|
this.lang = prefs.lang
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ConsoleCommand {
|
||||||
this.reply = text => process.stdout.write(parse(text) + '\n')
|
this.reply = text => process.stdout.write(parse(text) + '\n')
|
||||||
this.uuid = 'dde5a2a6-ebdd-7bbb-8eac-f75b10c10446'
|
this.uuid = 'dde5a2a6-ebdd-7bbb-8eac-f75b10c10446'
|
||||||
this.username = 'Owner'
|
this.username = 'Owner'
|
||||||
this.nickname = 'Console'
|
this.nickname = 'Owner'
|
||||||
this.command = cmd
|
this.command = cmd
|
||||||
this.msgType = '_bot_console'
|
this.msgType = '_bot_console'
|
||||||
this.prefix = ''
|
this.prefix = ''
|
||||||
|
@ -20,6 +20,7 @@ class ConsoleCommand {
|
||||||
this.verify = 3
|
this.verify = 3
|
||||||
this.host = ''
|
this.host = ''
|
||||||
this.port = '3'
|
this.port = '3'
|
||||||
|
this.serverName = 'botvX Console'
|
||||||
this.lang = settings.defaultLang
|
this.lang = settings.defaultLang
|
||||||
this.colors = settings.colors
|
this.colors = settings.colors
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue