Skip to content

Instantly share code, notes, and snippets.

@Darthfett
Last active December 11, 2015 21:59
Show Gist options
  • Select an option

  • Save Darthfett/4666616 to your computer and use it in GitHub Desktop.

Select an option

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").
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