chipmunkbot3/commands/netmsg.js
2024-07-31 22:34:19 -04:00

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