chipmunkbot3/commands/netmsg.js

24 lines
645 B
JavaScript
Executable file

const { literal, argument, greedyString } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('netmsg')
.then(
argument('message', greedyString())
.executes(c => this.netMsgCommand(c))
)
)
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')
bot.bots.forEach((bot2) => bot2.fancyMsg(bot.hostPortPair, source.displayName, message))
}
}