chipmunkbot3/commands/netmsg.js

25 lines
645 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(c => this.netMsgCommand(c))
2024-04-02 17:53:10 -04:00
)
)
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
bot.bots.forEach((bot2) => bot2.fancyMsg(bot.hostPortPair, source.displayName, message))
2024-04-02 17:53:10 -04:00
}
}