aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-04-25 13:34:04 +0200
committertv <tv@nomic.retiolum>2014-04-25 13:34:04 +0200
commit97e2b11759fe3066b3d12bb9d47c981959c3cde8 (patch)
tree0b8c7dae087505b300577edbd54a55f7d60f0020
parentbf00ab1a5449bb0bf554b49fbd5da6e882a44b2e (diff)
reaktor: move config_filename to config
-rwxr-xr-xIRC/reaktor.py1
-rw-r--r--config.py14
2 files changed, 10 insertions, 5 deletions
diff --git a/IRC/reaktor.py b/IRC/reaktor.py
index 54091c5..bfd08d9 100755
--- a/IRC/reaktor.py
+++ b/IRC/reaktor.py
@@ -81,7 +81,6 @@ class Reaktor(asybot):
target.append(env['_from'])
log.debug('target:' +str(target))
- env['config_filename'] = os.path.abspath(self.config)
start = time()
try:
p = popen(myargv, bufsize=1, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd)
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<args>.*))?$',
- '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'),