2024-11-19 20:22:47 -05:00
|
|
|
import { bots } from '../index.js'
|
|
|
|
import { getMessage } from '../util/lang.js'
|
|
|
|
|
|
|
|
const execute = (c) => {
|
|
|
|
let host = c.host
|
|
|
|
let port = c.port
|
|
|
|
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',
|
|
|
|
with: [
|
|
|
|
{
|
|
|
|
text: c.serverName,
|
|
|
|
hoverEvent: {
|
|
|
|
action: 'show_text',
|
|
|
|
value: {
|
|
|
|
translate: '%s: %s:%s',
|
|
|
|
with: [
|
|
|
|
{
|
|
|
|
text: getMessage(c.lang, 'command.netmsg.serverAddress'),
|
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: host,
|
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: port + '',
|
|
|
|
color: c.colors.primary
|
|
|
|
}
|
|
|
|
],
|
|
|
|
color: c.colors.secondary
|
|
|
|
}
|
|
|
|
},
|
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: c.username,
|
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: c.args.join(' ').slice(0, 512)
|
|
|
|
}
|
|
|
|
],
|
2024-11-20 01:39:51 -05:00
|
|
|
color: c.colors.tertiary
|
2024-11-19 20:22:47 -05:00
|
|
|
}
|
|
|
|
bots.forEach(item => {
|
|
|
|
if (item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== 'console') return
|
|
|
|
item.tellraw('@a', json)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export { execute }
|