summaryrefslogtreecommitdiffstats
path: root/Reaktor
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-04-25 13:19:50 +0200
committertv <tv@nomic.retiolum>2014-04-25 13:19:50 +0200
commite1571b5a5cda983234cd6d5c4998ab883cc46115 (patch)
tree0229f369e78f7674408c742f8b1157870076cb15 /Reaktor
parent4fbc3dd22e5ee5c04fd346a9424f796e671a6f05 (diff)
reaktor config: unify ^(<name>|*):
Diffstat (limited to 'Reaktor')
-rw-r--r--Reaktor/config.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Reaktor/config.py b/Reaktor/config.py
index 48406bf9..90540340 100644
--- a/Reaktor/config.py
+++ b/Reaktor/config.py
@@ -20,13 +20,14 @@ irc_channels = [
admin_file='admin.lst'
auth_file='auth.lst'
-# name_re is used, so name cannot kill our patterns below
-name_re = re.escape(name)
+# me is used, so name cannot kill our patterns below
+me = '\\b' + re.escape(name) + '\\b'
+me_or_us = '(?:' + me + '|\\*)'
def default_command(cmd):
return {
'capname': cmd,
- 'pattern': '^(?:' + name_re + '|\\*):\\s*' + cmd + '\\s*(?:\\s+(?P<args>.*))?$',
+ 'pattern': '^' + me_or_us + ':\\s*' + cmd + '\\s*(?:\\s+(?P<args>.*))?$',
'argv': [ 'commands/' + cmd ] }
public_commands = [
@@ -38,19 +39,19 @@ public_commands = [
default_command('nocommand'),
{
'capname': 'tell',
- 'pattern': '^' + name_re + ':\\s*' + 'tell' + '\\s*(?:\\s+(?P<args>.*))?$',
+ 'pattern': '^' + me_or_us + ':\\s*' + 'tell' + '\\s*(?:\\s+(?P<args>.*))?$',
'argv': [ 'commands/tell-on_privmsg' ],
'env': { 'state_file': workdir + '/tell.txt' }
},
# command not found
- { 'pattern': '^(?:' + name_re + '|\\*):.*',
+ { 'pattern': '^' + me_or_us + ':.*',
'argv': [ 'commands/respond','You are made of stupid!'] },
# "highlight"
- { 'pattern': '.*\\b' + name_re + '\\b.*',
+ { 'pattern': '.*' + me + '.*',
'argv': [ 'commands/say', 'I\'m famous' ] },
# identify via direct connect
{ 'capname': 'identify',
- 'pattern': '^identify' + '\\s*(?:\\s+(?P<args>.*))?$',
+ 'pattern': '^identify' + '\\s*(?:\\s+(?P<args>.*))?$',
'argv' : [ 'commands/identify' ]}
]
commands = [