owobot/commands/netmsg.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-09-12 00:09:00 -04:00
const { bots } = require('../index.js')
2024-08-12 05:13:32 -04:00
const { getMessage } = require('../util/lang.js')
module.exports = {
execute: (c) => {
let host = c.host
let port = c.port
2024-08-24 10:15:39 -04:00
if (c.bot.host.options && c.bot.host.options.hidden) {
host = 'localhost' // Makes hidden servers appear as localhost
port = '25565'
2024-09-19 22:21:01 -04:00
} else if (c.bot.host.options && c.bot.host.options.displayAsIPv6) {
2024-09-13 23:24:48 -04:00
host = `[${host}]`
2024-08-12 05:13:32 -04:00
}
const json = {
translate: '[%s] %s: %s',
with: [
{
text: c.serverName,
hoverEvent: {
2024-08-24 10:15:39 -04:00
action: 'show_text',
value: {
translate: '%s: %s:%s',
with: [
{
2024-08-24 10:15:39 -04:00
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
},
{
2024-09-19 22:21:01 -04:00
text: c.args.join(' ').slice(0, 512)
2024-07-27 02:39:18 -04:00
}
],
color: 'white'
}
2024-09-12 00:09:00 -04:00
bots.forEach(item => {
2024-08-25 22:29:39 -04:00
if (item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== 'console') return
item.tellraw('@a', json)
})
}
2024-07-27 02:39:18 -04:00
}