summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2012-04-17 23:30:41 +0200
committermakefu <github@syntax-fehler.de>2012-04-17 23:30:41 +0200
commit3741d76a38dc4b412780eb2a4ad79467a01f884b (patch)
tree82745a2f48042f480eddb937d6fdf825c41570b6 /Reaktor/IRC
parent8fbe16567c698415d1be1c0d75445ccb7369a497 (diff)
add clean arguments to bot
Diffstat (limited to 'Reaktor/IRC')
-rwxr-xr-xReaktor/IRC/asybot.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py
index 657cee40..17f9cb3a 100755
--- a/Reaktor/IRC/asybot.py
+++ b/Reaktor/IRC/asybot.py
@@ -12,6 +12,8 @@ from asyncore import loop
from socket import AF_INET, SOCK_STREAM
from signal import SIGALRM, signal, alarm
from datetime import datetime as date, timedelta
+import shlex
+from time import sleep
from sys import exit
from re import split, search
@@ -107,6 +109,7 @@ class asybot(asychat):
def PRIVMSG(text):
msg = 'PRIVMSG %s :%s' % (','.join(params), text)
self.push(msg)
+ sleep(2)
def ME(text):
PRIVMSG('ACTION ' + text + '')
@@ -133,11 +136,12 @@ class asybot(asychat):
if is_executable(command):
env = {}
+ args = []
if _argument != None:
env['argument'] = _argument
-
+ args = shlex.split(_argument)
try:
- p = popen([command], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
+ p = popen([command] + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
except OSError, error:
ME('brain damaged')
log.error('OSError@%s: %s' % (command, error))
@@ -181,8 +185,12 @@ if __name__ == "__main__":
lol = logging.DEBUG if env.get('debug',False) else logging.INFO
logging.basicConfig(level=lol)
- name = getconf1('Name', '/etc/tinc/retiolum/tinc.conf')
- hostname = '%s.retiolum' % name
+ try:
+ name = getconf1('Name', '/etc/tinc/retiolum/tinc.conf')
+ hostname = '%s.retiolum' % name
+ except:
+ name = socket.gethostname()
+ hostname = name
nick = str(env.get('nick', name))
host = str(env.get('host', 'supernode'))
port = int(env.get('port', 6667))