Refactor command functions
no more .bind(this)!
This commit is contained in:
parent
447de630a1
commit
a362324478
27 changed files with 50 additions and 50 deletions
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
literal('bruhify')
|
||||
.then(
|
||||
argument('message', greedyString())
|
||||
.executes(this.bruhifyCommand.bind(this))
|
||||
.executes(c => this.bruhifyCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
literal('cb')
|
||||
.then(
|
||||
argument('command', greedyString())
|
||||
.executes(this.runCommand)
|
||||
.executes(c => this.runCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('clearchat')
|
||||
.executes(this.clearChatCommand.bind(this))
|
||||
.executes(c => this.clearChatCommand(c))
|
||||
.then(
|
||||
argument('targets', greedyString())
|
||||
.executes(this.targettedclearChatCommand.bind(this))
|
||||
.executes(c => this.targettedclearChatCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
dispatcher.register(literal('cc').executes(this.clearChatCommand.bind(this)).redirect(node))
|
||||
dispatcher.register(literal('cc').executes(c => this.clearChatCommand(c)).redirect(node))
|
||||
|
||||
node.description = 'Clears the chat of everyone or a specific player'
|
||||
node.permissionLevel = 0
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
literal('create')
|
||||
.then(
|
||||
argument('options', json())
|
||||
.executes(this.createCommand.bind(this))
|
||||
.executes(c => this.createCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
|
@ -30,7 +30,7 @@ module.exports = {
|
|||
argument('name', string())
|
||||
.then(
|
||||
argument('data', json())
|
||||
.executes(this.writeCommand.bind(this))
|
||||
.executes(c => this.writeCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -39,12 +39,12 @@ module.exports = {
|
|||
literal('end')
|
||||
.then(
|
||||
argument('client', string())
|
||||
.executes(this.endCommand.bind(this))
|
||||
.executes(c => this.endCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('list')
|
||||
.executes(this.listCommand.bind(this))
|
||||
.executes(c => this.listCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
argument('interval', integer())
|
||||
.then(
|
||||
argument('command', greedyString())
|
||||
.executes(this.addCommand)
|
||||
.executes(c => this.addCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -19,16 +19,16 @@ module.exports = {
|
|||
literal('remove')
|
||||
.then(
|
||||
argument('index', integer())
|
||||
.executes(this.removeCommand)
|
||||
.executes(c => this.removeCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('list')
|
||||
.executes(this.listCommand)
|
||||
.executes(c => this.listCommand(c))
|
||||
)
|
||||
.then(
|
||||
literal('clear')
|
||||
.executes(this.clearCommand)
|
||||
.executes(c => this.clearCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('credits')
|
||||
.executes(this.creditsCommand)
|
||||
.executes(c => this.creditsCommand(c))
|
||||
)
|
||||
|
||||
node.description = 'Lists people who have contributed to the bot'
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
literal('csvr')
|
||||
.then(
|
||||
argument('host', greedyString())
|
||||
.executes(this.consoleServerCommand)
|
||||
.executes(c => this.consoleServerCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
literal('echo')
|
||||
.then(
|
||||
argument('message', greedyString())
|
||||
.executes(this.echoCommand)
|
||||
.executes(c => this.echoCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('end')
|
||||
.executes(this.endCommand)
|
||||
.executes(c => this.endCommand(c))
|
||||
)
|
||||
|
||||
node.description = "Ends the bot's connection to the server"
|
||||
|
|
|
@ -7,10 +7,10 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('help')
|
||||
.executes(this.listCommands)
|
||||
.executes(c => this.listCommands(c))
|
||||
.then(
|
||||
argument('command', greedyString())
|
||||
.executes(this.showCommandInfo)
|
||||
.executes(c => this.showCommandInfo(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
literal('hole')
|
||||
.then(
|
||||
argument('targets', greedyString())
|
||||
.executes(this.holeCommand)
|
||||
.executes(c => this.holeCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -13,15 +13,15 @@ module.exports = {
|
|||
literal('render')
|
||||
.then(
|
||||
argument('location', location(bot.paths.images))
|
||||
.executes(this.renderCommand)
|
||||
.executes(c => this.renderCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('list')
|
||||
.executes(this.listCommand.bind(this))
|
||||
.executes(c => this.listCommand(c))
|
||||
.then(
|
||||
argument('location', path(bot.paths.images))
|
||||
.executes(this.locationListCommand.bind(this))
|
||||
.executes(c => this.locationListCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -10,19 +10,19 @@ module.exports = {
|
|||
argument('pin', integer())
|
||||
.then(
|
||||
argument('username', greedyString())
|
||||
.executes(this.joinCommand)
|
||||
.executes(c => this.joinCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('leave')
|
||||
.executes(this.leaveCommand)
|
||||
.executes(c => this.leaveCommand(c))
|
||||
)
|
||||
.then(
|
||||
literal('answer')
|
||||
.then(
|
||||
argument('answer', integer())
|
||||
.executes(this.answerCommand)
|
||||
.executes(c => this.answerCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -22,12 +22,12 @@ module.exports = {
|
|||
literal('count')
|
||||
.then(
|
||||
argument('string', greedyString())
|
||||
.executes(this.countCommand.bind(this))
|
||||
.executes(c => this.countCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('abort')
|
||||
.executes(this.abortCommand.bind(this))
|
||||
.executes(c => this.abortCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const UNABLE_TO_LOAD_PLAYER_DATA_ERROR = new DynamicCommandExceptionType(error =
|
|||
|
||||
module.exports = {
|
||||
register (dispatcher) {
|
||||
const listNode = literal('list').executes(this.listCommand).build()
|
||||
const listNode = literal('list').executes(c => this.listCommand(c)).build()
|
||||
|
||||
const node = dispatcher.register(
|
||||
literal('mail')
|
||||
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
argument('username', string())
|
||||
.then(
|
||||
argument('message', greedyString())
|
||||
.executes(this.sendCommand)
|
||||
.executes(c => this.sendCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -24,12 +24,12 @@ module.exports = {
|
|||
)
|
||||
.then(
|
||||
literal('read')
|
||||
.executes(this.listCommand)
|
||||
.executes(c => this.listCommand(c))
|
||||
.redirect(listNode)
|
||||
)
|
||||
.then(
|
||||
literal('clear')
|
||||
.executes(this.clearCommand)
|
||||
.executes(c => this.clearCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('matrix')
|
||||
.executes(this.matrixCommand)
|
||||
.executes(c => this.matrixCommand(c))
|
||||
)
|
||||
|
||||
node.description = 'Sends the Matrix invite'
|
||||
|
|
|
@ -13,27 +13,27 @@ module.exports = {
|
|||
literal('play')
|
||||
.then(
|
||||
argument('location', location(bot.paths.music))
|
||||
.executes(this.playCommand)
|
||||
.executes(c => this.playCommand(c))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal('skip')
|
||||
.executes(this.skipCommand)
|
||||
.executes(c => this.skipCommand(c))
|
||||
)
|
||||
.then(
|
||||
literal('stop')
|
||||
.executes(this.stopCommand)
|
||||
.executes(c => this.stopCommand(c))
|
||||
)
|
||||
.then(
|
||||
literal('loop')
|
||||
.executes(this.loopCommand)
|
||||
.executes(c => this.loopCommand(c))
|
||||
)
|
||||
.then(
|
||||
literal('list')
|
||||
.executes(this.listCommand.bind(this))
|
||||
.executes(c => this.listCommand(c))
|
||||
.then(
|
||||
argument('location', path(bot.paths.music))
|
||||
.executes(this.locationListCommand.bind(this))
|
||||
.executes(c => this.locationListCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('myuser')
|
||||
.executes(this.myUserCommand)
|
||||
.executes(c => this.myUserCommand(c))
|
||||
)
|
||||
|
||||
node.description = 'Sends the username of the sender of the command'
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
literal('netmsg')
|
||||
.then(
|
||||
argument('message', greedyString())
|
||||
.executes(this.netMsgCommand)
|
||||
.executes(c => this.netMsgCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
literal('rainbowify')
|
||||
.then(
|
||||
argument('message', greedyString())
|
||||
.executes(this.rainbowifyCommand)
|
||||
.executes(c => this.rainbowifyCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('randomteleport')
|
||||
.executes(this.randomTeleportCommand)
|
||||
.executes(c => this.randomTeleportCommand(c))
|
||||
)
|
||||
|
||||
dispatcher.register(literal('rtp').executes(this.randomTeleportCommand).redirect(node))
|
||||
dispatcher.register(literal('rtp').executes(c => this.randomTeleportCommand(c)).redirect(node))
|
||||
|
||||
node.description = 'Teleports the sender to a random location'
|
||||
node.permissionLevel = 0
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('rc')
|
||||
.executes(this.refillCoreCommand)
|
||||
.executes(c => this.refillCoreCommand(c))
|
||||
)
|
||||
|
||||
node.description = "Refills the bot's command core"
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
register (dispatcher) {
|
||||
const node = dispatcher.register(
|
||||
literal('reload')
|
||||
.executes(this.reloadCommand)
|
||||
.executes(c => this.reloadCommand(c))
|
||||
)
|
||||
|
||||
node.description = 'Attempts to reload all commands'
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
literal('seen')
|
||||
.then(
|
||||
argument('username', string())
|
||||
.executes(this.seenCommand)
|
||||
.executes(c => this.seenCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
argument('amount', integer())
|
||||
.then(
|
||||
argument('entity', string())
|
||||
.executes(this.spawnMobCommand)
|
||||
.executes(c => this.spawnMobCommand(c))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
literal('urban')
|
||||
.then(
|
||||
argument('word', greedyString())
|
||||
.executes(this.urbanCommand.bind(this))
|
||||
.executes(c => this.urbanCommand(c))
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
const node = dispatcher.register(
|
||||
literal('validate')
|
||||
.requires(source => source.permissionLevel >= 1)
|
||||
.executes(this.validateCommand)
|
||||
.executes(c => this.validateCommand(c))
|
||||
)
|
||||
|
||||
node.description = 'Checks if a hash is valid'
|
||||
|
|
Loading…
Reference in a new issue