summaryrefslogtreecommitdiffstats
path: root/Reaktor
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-04-25 13:48:34 +0200
committertv <tv@nomic.retiolum>2014-04-25 13:48:34 +0200
commitebf658d66ce61a21c3363a8313d847efaf13d21c (patch)
tree4a6bc52149a5c19899ab971721bb016c299973af /Reaktor
parent9e5e76fd2532a47b0cc47f4d01266b7c35299470 (diff)
reaktor config: introduce simple_command
Diffstat (limited to 'Reaktor')
-rw-r--r--Reaktor/config.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/Reaktor/config.py b/Reaktor/config.py
index eba1f093..90f33d38 100644
--- a/Reaktor/config.py
+++ b/Reaktor/config.py
@@ -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')