summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-12-18 16:58:51 +0100
committertv <tv@nomic.retiolum>2013-12-18 16:58:51 +0100
commitdf09258ff26b98fcba7065208e230b71672c6055 (patch)
treee3d9c83eb5d9b3b96974dbf91cdae75d3058da92
parentb1df5ae25e8bc336bb50ef5a2deb4dd40ee809ed (diff)
Reaktor: listen to own name
-rw-r--r--Reaktor/config.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Reaktor/config.py b/Reaktor/config.py
index 92d97af5..1b285e4b 100644
--- a/Reaktor/config.py
+++ b/Reaktor/config.py
@@ -12,13 +12,19 @@ irc_channels = [
'#krebs'
]
+def default_command(cmd):
+ return {
+ 'pattern': '^(?:' + name + '|\\*):\\s*' + cmd + '\\s*$',
+ 'argv': [ 'commands/' + cmd ] }
+
irc_commands = [
- { 'pattern': '^(?:asybot|\\*):\\s*caps\\s*$', 'argv': [ 'commands/caps' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*hello\\s*$', 'argv': [ 'commands/hello' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*reload\\s*$', 'argv': [ 'commands/reload' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*badcommand\\s*$', 'argv': [ 'commands/badcommand' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*rev\\s*$', 'argv': [ 'commands/rev' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*uptime\\s*$', 'argv': [ 'commands/uptime' ] },
- { 'pattern': '^(?:asybot|\\*):\\s*nocommand\\s*$', 'argv': [ 'commands/nocommand' ] },
- { 'pattern': '^.*\\basybot(?:\\b[^:].*)?$', 'argv': [ 'commands/say', 'I\'m famous' ] }
+ default_command('caps'),
+ default_command('hello'),
+ default_command('reload'),
+ default_command('badcommand'),
+ default_command('rev'),
+ default_command('uptime'),
+ default_command('nocommand'),
+ { 'pattern': '^.*\\b' + name + '(?:\\b[^:].*)?$',
+ 'argv': [ 'commands/say', 'I\'m famous' ] }
]