Last active
December 11, 2015 21:59
-
-
Save Darthfett/4666616 to your computer and use it in GitHub Desktop.
The new chat commands structure: You can now register to commands with spaces. One-word commands are run before 2+ word commands (e.g. handlers registered to "dig" would before handlers registered to "dig here").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commands = { | |
| 'dig': { | |
| handlers: [ | |
| { | |
| handler: someFunction, | |
| minArgs: 0, | |
| maxArgs: Infinity, | |
| }, | |
| { | |
| handler: anotherFunction, | |
| minArgs: 0, | |
| maxArgs: Infinity, | |
| }, | |
| ], | |
| commands: { | |
| 'here': { | |
| handlers: [ | |
| { | |
| handler: dig_here, | |
| minArgs: 0, | |
| maxArgs: 0, | |
| }, | |
| ], | |
| commands: {}, | |
| }, | |
| }, | |
| }, | |
| 'eat': { | |
| handlers: [ | |
| { | |
| handler: eatFood, | |
| minArgs: 0, | |
| maxArgs: Infinity, | |
| }, | |
| ], | |
| commands: {}, | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment