chipmunkbot3/commands/netmsg.js

26 lines
649 B
JavaScript
Raw Normal View History

2024-04-02 17:53:10 -04:00
const { literal, argument, greedyString } = require('brigadier-commands')
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('netmsg')
.then(
argument('message', greedyString())
.executes(this.netMsgCommand)
)
)
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
node.description = 'Runs a command in the command core'
node.permissionLevel = 0
},
netMsgCommand (context) {
const source = context.source
const bot = source.bot
const message = context.getArgument('message')
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
const host = bot.host
bot.bots.forEach((bot) => bot.fancyMsg(host, source.displayName, message))
}
}