diff options
author | tv <tv@nomic.retiolum> | 2014-04-25 13:42:45 +0200 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2014-04-25 13:42:45 +0200 |
commit | b73babb4bfcacedc067a512e85913c77c574d859 (patch) | |
tree | 6512e81bfbf562d114d59f443a9bc1924bfad3a2 | |
parent | 97e2b11759fe3066b3d12bb9d47c981959c3cde8 (diff) |
reaktor config: tell is a default_command
-rw-r--r-- | config.py | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -26,10 +26,11 @@ config_filename = abspath(__file__) me = '\\b' + re.escape(name) + '\\b' me_or_us = '(?:' + me + '|\\*)' -def default_command(cmd, env={}): +def default_command(cap, cmd=None, env={}): + if cmd == None: cmd=cap return { - 'capname': cmd, - 'pattern': '^' + me_or_us + ':\\s*' + cmd + '\\s*(?:\\s+(?P<args>.*))?$', + 'capname': cap, + 'pattern': '^' + me_or_us + ':\\s*' + cap + '\\s*(?:\\s+(?P<args>.*))?$', 'argv': [ 'commands/' + cmd ], 'env': env } @@ -43,12 +44,9 @@ public_commands = [ default_command('rev'), default_command('uptime'), default_command('nocommand'), - { - 'capname': 'tell', - 'pattern': '^' + me_or_us + ':\\s*' + 'tell' + '\\s*(?:\\s+(?P<args>.*))?$', - 'argv': [ 'commands/tell-on_privmsg' ], - 'env': { 'state_file': workdir + '/tell.txt' } - }, + default_command('tell', cmd='tell-on_privmsg', env={ + 'state_file': workdir + '/tell.txt' + }), # command not found { 'pattern': '^' + me_or_us + ':.*', 'argv': [ 'commands/respond','You are made of stupid!'] }, |