Add IPv6 server display mode
This commit is contained in:
parent
3a6867ee96
commit
6cdec0db4d
3 changed files with 12 additions and 2 deletions
|
@ -221,6 +221,11 @@ const displayServerList = function (c) {
|
|||
if (item.host.options && item.host.options.hidden && c.verify !== 2 && c.bot.id !== i) return
|
||||
let message = 'command.about.serverListItem'
|
||||
if (c.bot.id === i) message = 'command.about.serverListItem.thisServer'
|
||||
let host = item.host.host
|
||||
let port = item.host.port
|
||||
if(item.host.options && item.host.options.displayAsIPv6){
|
||||
host = `[${host}]`
|
||||
}
|
||||
c.reply({
|
||||
translate: getMessage(c.lang, message),
|
||||
color: c.colors.secondary,
|
||||
|
@ -230,11 +235,11 @@ const displayServerList = function (c) {
|
|||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
text: `${item.host.host}:${item.host.port}`,
|
||||
text: `${host}:${port}`,
|
||||
color: c.colors.primary,
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${item.host.host}:${item.host.port}`
|
||||
value: `${host}:${port}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
|
|
|
@ -7,6 +7,8 @@ module.exports = {
|
|||
if (c.bot.host.options && c.bot.host.options.hidden) {
|
||||
host = 'localhost' // Makes hidden servers appear as localhost
|
||||
port = '25565'
|
||||
} else if(c.bot.host.options && c.bot.host.options.displayAsIPv6){
|
||||
host = `[${host}]`
|
||||
}
|
||||
const json = {
|
||||
translate: '[%s] %s: %s',
|
||||
|
|
3
index.js
3
index.js
|
@ -70,6 +70,9 @@ const createBot = function createBot (host, oldId) {
|
|||
}
|
||||
|
||||
bot.host = host
|
||||
if(bot.host.host.includes(":")){
|
||||
bot.host.options.displayAsIPv6 = true
|
||||
}
|
||||
bot.interval = {}
|
||||
|
||||
bot.info = (msg) => {
|
||||
|
|
Loading…
Reference in a new issue