From 97e2b11759fe3066b3d12bb9d47c981959c3cde8 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 25 Apr 2014 13:34:04 +0200 Subject: reaktor: move config_filename to config --- config.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index 9054034..7f3f9c4 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,4 @@ -from os.path import expanduser +from os.path import abspath, expanduser import re debug = True @@ -20,18 +20,24 @@ irc_channels = [ admin_file='admin.lst' auth_file='auth.lst' +config_filename = abspath(__file__) + # me is used, so name cannot kill our patterns below me = '\\b' + re.escape(name) + '\\b' me_or_us = '(?:' + me + '|\\*)' -def default_command(cmd): +def default_command(cmd, env={}): return { 'capname': cmd, 'pattern': '^' + me_or_us + ':\\s*' + cmd + '\\s*(?:\\s+(?P.*))?$', - 'argv': [ 'commands/' + cmd ] } + 'argv': [ 'commands/' + cmd ], + 'env': env + } public_commands = [ - default_command('caps'), + default_command('caps', env={ + 'config_filename': config_filename + }), default_command('hello'), default_command('badcommand'), default_command('rev'), -- cgit v1.2.3