owobot/commands/netmsg.js

55 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-08-12 05:13:32 -04:00
const { bot } = require('../index.js')
const { getMessage } = require('../util/lang.js')
module.exports = {
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"
2024-08-12 05:13:32 -04:00
}
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(' ')
2024-07-27 02:39:18 -04:00
}
],
color: 'white'
}
bot.forEach(item => {
2024-08-25 22:20:34 -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
}