chipmunkbot3/commands/netmsg.js

25 lines
649 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(this.netMsgCommand)
)
)
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')
const host = bot.host
bot.bots.forEach((bot) => bot.fancyMsg(host, source.displayName, message))
}
}