const { literal, argument, integer, greedyString } = require('brigadier-commands') module.exports = { register (dispatcher) { const node = dispatcher.register( literal('kahoot') .then( literal('join') .then( argument('pin', integer()) .then( argument('username', greedyString()) .executes(c => this.joinCommand(c)) ) ) ) .then( literal('leave') .executes(c => this.leaveCommand(c)) ) .then( literal('answer') .then( argument('answer', integer()) .executes(c => this.answerCommand(c)) ) ) ) node.description = 'kahoot client lol' node.permissionLevel = 0 }, joinCommand (context) { const bot = context.source.bot bot.kahoot.join(context.getArgument('pin'), context.getArgument('username')) }, leaveCommand (context) { const bot = context.source.bot bot.kahoot.leave() }, answerCommand (context) { const bot = context.source.bot bot.kahoot.answer(context.getArgument('answer')) } }