Add IPv6 server display mode

This commit is contained in:
7cc5c4f330d47060 2024-09-13 23:24:48 -04:00
parent 3a6867ee96
commit 6cdec0db4d
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:ACESPPwnsy88x7h9TZQ44QamQIRO9ngTeusTB6Kg9cY
3 changed files with 12 additions and 2 deletions

View file

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

View file

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

View file

@ -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) => {