summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Reaktor/IRC/ircasy.py13
-rw-r--r--news/newsbot.py26
-rw-r--r--retiolum/hosts/kiosk1
3 files changed, 28 insertions, 12 deletions
diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py
index 150498dd..fd261ae9 100644
--- a/Reaktor/IRC/ircasy.py
+++ b/Reaktor/IRC/ircasy.py
@@ -112,11 +112,7 @@ class asybot(asychat):
elif command == '433':
# ERR_NICKNAMEINUSE, retry with another name
- _, nickname, int, _ = split('^.*[^0-9]([0-9]+)$', self.nickname) \
- if search('[0-9]$', self.nickname) \
- else ['', self.nickname, 0, '']
- self.nickname = nickname + str(int + 1)
- self.handle_connect()
+ self.on_nickinuse(prefix, command, params, rest)
elif command == '376':
self.on_welcome(prefix, command, params, rest)
@@ -175,3 +171,10 @@ class asybot(asychat):
def on_invite(self, prefix, command, params, rest):
pass
+
+ def on_nickinuse(self, prefix, command, params, rest):
+ _, nickname, int, _ = split('^.*[^0-9]([0-9]+)$', self.nickname) \
+ if search('[0-9]$', self.nickname) \
+ else ['', self.nickname, 0, '']
+ self.nickname = nickname + str(int + 1)
+ self.handle_connect()
diff --git a/news/newsbot.py b/news/newsbot.py
index 899c5dd2..8834851d 100644
--- a/news/newsbot.py
+++ b/news/newsbot.py
@@ -139,6 +139,8 @@ class RssBot(asybot):
self.loop = True
self.lastnew = datetime.now()
self.url_shortener = url_shortener
+ self.retry = True
+ self.on_nickinuse = lambda: None
def start_rss(self):
self.upd_loop = threading.Thread(target=self.updateloop)
@@ -175,8 +177,8 @@ class RssBot(asybot):
self.sendall(entry.title + ' ' + shorturl)
self.oldnews.append(entry.link)
self.lastnew = datetime.now()
- except:
- print(self.nickname + ': rss timeout occured')
+ except Exception as e:
+ print(str(datetime.now().hour) + ':' + str(datetime.now().minute) + ' ' + self.nickname + ': ' + str(e))
sleep(self.to)
def shortenurl(self, url):
@@ -193,7 +195,10 @@ class RssBot(asybot):
self.send_msg(target, feed.title + ' ' + self.shortenurl(feed.link))
def sendall(self, string):
- self.send_msg(self.channels, string)
+ try:
+ self.send_msg(self.channels, string)
+ except Exception as e:
+ print(self.nickname + ': failed sending all to ' + str(self.channels) + ' because of ' + str(e));
def send_msg(self, target, string):
if self.connected:
@@ -209,9 +214,9 @@ class RssBot(asybot):
else:
self.reconnect()
while not self.connected:
- sleep(3)
- print('waiting for reconnect')
- self.send_msg(string)
+ sleep(10)
+ print(self.nickname + ' waiting for reconnect')
+ self.send_msg(target, string)
def on_invite(self, prefix, command, params, rest):
for chan in rest.split():
@@ -237,5 +242,12 @@ for line in lines:
bot.start_rss()
bots[linear[0]] = bot
-th = threading.Thread(target=loop)
+def thread_handler():
+ while True:
+ try:
+ loop()
+ except Exception as e:
+ print('ohoh ' + e)
+
+th = threading.Thread(target=thread_handler)
th.start()
diff --git a/retiolum/hosts/kiosk b/retiolum/hosts/kiosk
index b490e8cd..8f53a08f 100644
--- a/retiolum/hosts/kiosk
+++ b/retiolum/hosts/kiosk
@@ -1,3 +1,4 @@
+Address = 2003:6a:674e:1001:211:25ff:fe05:a54d/64
Subnet = 10.243.232.122
Subnet = 42:1ad1:b481:00f5:aab8:f8cc:51fe:4b87