chipmunkbot3/commands/cb.js

22 lines
513 B
JavaScript
Raw Permalink 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('cb')
.then(
argument('command', greedyString())
.executes(c => this.runCommand(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
},
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
runCommand (context) {
const bot = context.source.bot
bot.core.run(context.getArgument('command'))
}
}