chipmunkbot3/commands/echo.js

21 lines
544 B
JavaScript

const { literal, argument, greedyString } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('echo')
.then(
argument('message', greedyString())
.executes(this.echoCommand)
)
)
node.description = 'Sends a message in chat as the bot'
node.permissionLevel = 0
},
echoCommand (context) {
const bot = context.source.bot
bot.core.run(`essentials:sudo ${bot.uuid} c:${context.getArgument('message')}`)
}
}