aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <root@pigstarter.de>2013-12-18 23:08:07 +0100
committermakefu <root@pigstarter.de>2013-12-18 23:08:07 +0100
commit481ab0216f9d877b8cb8bd70e8d0d024d0d86b7d (patch)
treeebc8bf9421a4d52ea889d5e0dd281413cc692869
parent843c254b6b868b3b83f20fdfef4d620d4be83a8b (diff)
Reaktor: irc_commands -> commands
-rwxr-xr-xIRC/asybot.py4
-rw-r--r--IRC/getconf.py4
-rw-r--r--TODO1
-rwxr-xr-xcommands/caps2
-rw-r--r--config.py4
5 files changed, 7 insertions, 8 deletions
diff --git a/IRC/asybot.py b/IRC/asybot.py
index 38f0df1..0ac7a27 100755
--- a/IRC/asybot.py
+++ b/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/IRC/getconf.py b/IRC/getconf.py
index d6e9f42..f9cd440 100644
--- a/IRC/getconf.py
+++ b/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/TODO b/TODO
index 8eb4073..dc0c5e7 100644
--- a/TODO
+++ b/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/commands/caps b/commands/caps
index a9ce451..c47319f 100755
--- a/commands/caps
+++ b/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/config.py b/config.py
index ed8c5ef..ce86faa 100644
--- a/config.py
+++ b/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'),