chipmunkbot3/commands/csvr.js

25 lines
584 B
JavaScript

const { literal, argument, greedyString } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('csvr')
.then(
argument('host', greedyString())
.executes(this.consoleServerCommand)
)
)
node.description = 'Sets the console server'
node.permissionLevel = 0
},
consoleServerCommand (context) {
const bot = context.source.bot
const host = context.getArgument('host')
for (const other of bot.bots) {
other.console.host = host
}
}
}