diff options
author | tv <tv@nomic.retiolum> | 2014-04-25 13:48:34 +0200 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2014-04-25 13:48:34 +0200 |
commit | d720bcab3a35330962211980dfeedf5f2016522e (patch) | |
tree | 6f506b183e41e2b9ec3eb5217ed117fb21bee899 | |
parent | 83afbcf53ad2af9b7ee82c69f501068fb9b7b8f4 (diff) |
reaktor config: introduce simple_command
-rw-r--r-- | config.py | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -35,6 +35,15 @@ def default_command(cap, cmd=None, env={}): 'env': env } +def simple_command(cap, cmd=None, env={}): + if cmd == None: cmd=cap + return { + 'capname': cap, + 'pattern': '^' + cap + '\\s*(?:\\s+(?P<args>.*))?$', + 'argv' : [ 'commands/' + cmd ], + 'env': env + } + public_commands = [ default_command('caps', env={ 'config_filename': config_filename @@ -54,13 +63,9 @@ public_commands = [ { 'pattern': '.*' + me + '.*', 'argv': [ 'commands/say', 'I\'m famous' ] }, # identify via direct connect - { 'capname': 'identify', - 'pattern': '^identify' + '\\s*(?:\\s+(?P<args>.*))?$', - 'argv' : [ 'commands/identify' ], - 'env': { - 'config_filename': config_filename - } - } + simple_command('identify', env={ + 'config_filename': config_filename + }) ] commands = [ default_command('reload') |