diff options
author | makefu <root@pigstarter.de> | 2013-12-18 23:08:07 +0100 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2013-12-18 23:08:07 +0100 |
commit | 0094250e65132614f3fbd9554d58c2f6220021b9 (patch) | |
tree | 14d065cd26ef183eaf09656a9c1093643c5813c7 /Reaktor | |
parent | 82deb81c8a147cfd5cd7e22e7f69b1a81e78c896 (diff) |
Reaktor: irc_commands -> commands
Diffstat (limited to 'Reaktor')
-rwxr-xr-x | Reaktor/IRC/asybot.py | 4 | ||||
-rw-r--r-- | Reaktor/IRC/getconf.py | 4 | ||||
-rw-r--r-- | Reaktor/TODO | 1 | ||||
-rwxr-xr-x | Reaktor/commands/caps | 2 | ||||
-rw-r--r-- | Reaktor/config.py | 4 |
5 files changed, 7 insertions, 8 deletions
diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py index 38f0df11..0ac7a279 100755 --- a/Reaktor/IRC/asybot.py +++ b/Reaktor/IRC/asybot.py @@ -20,7 +20,7 @@ from re import split, search, match from textwrap import TextWrapper import logging,logging.handlers -config_filename = 'config.py' +config_filename = './config.py' from getconf import make_getconf getconf = make_getconf(config_filename) @@ -129,7 +129,7 @@ class asybot(asychat): def ME(text): PRIVMSG(('ACTION ' + text + '').encode(encoding='UTF-8')) - for command in getconf('irc_commands'): + for command in getconf('commands'): y = match(command['pattern'], rest) if y: self.execute_command(command, y, prefix, PRIVMSG, ME) diff --git a/Reaktor/IRC/getconf.py b/Reaktor/IRC/getconf.py index d6e9f425..f9cd4404 100644 --- a/Reaktor/IRC/getconf.py +++ b/Reaktor/IRC/getconf.py @@ -8,12 +8,12 @@ import os def make_getconf(filename): - config = load_config(filename) def getconf(prop): prop_split = prop.split('.') string = '' - imp.reload(config) + config = load_config(filename) + #imp.reload(config) tmp = config.__dict__ for pr in prop_split: tmp = tmp[pr] diff --git a/Reaktor/TODO b/Reaktor/TODO index 8eb4073d..dc0c5e72 100644 --- a/Reaktor/TODO +++ b/Reaktor/TODO @@ -1,5 +1,4 @@ commands/caps: merge load_config with IRC/getconf.py -commands/caps: generalize for UDP getconf: reload inotify diff --git a/Reaktor/commands/caps b/Reaktor/commands/caps index a9ce4519..c47319f5 100755 --- a/Reaktor/commands/caps +++ b/Reaktor/commands/caps @@ -9,4 +9,4 @@ def load_config(filename): return imp.load_module(modname, file, pathname, description) config = load_config(os.environ['config_filename']) -print(' '.join(filter(None,[ x.get('capname',None) for x in config.irc_commands]))) +print(' '.join(filter(None,[ x.get('capname',None) for x in config.commands]))) diff --git a/Reaktor/config.py b/Reaktor/config.py index ed8c5efb..ce86faa9 100644 --- a/Reaktor/config.py +++ b/Reaktor/config.py @@ -2,7 +2,7 @@ debug = True # CAVEAT name should not contains regex magic -name = 'kwasybot' +name = 'crabmanner' irc_alarm_timeout = 300 irc_hammer_interval = 10 @@ -20,7 +20,7 @@ def default_command(cmd): 'pattern': '^(?:' + name + '|\\*):\\s*' + cmd + '\\s*$', 'argv': [ 'commands/' + cmd ] } -irc_commands = [ +commands = [ default_command('caps'), default_command('hello'), default_command('reload'), |