diff options
author | makefu <root@pigstarter.de> | 2014-03-16 15:01:22 +0100 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2014-03-16 15:01:22 +0100 |
commit | c503a92fd711a73762a44ea08cf10438ed03fa55 (patch) | |
tree | cc9c5f345ad2497563cc9f1b5552d7e09e2c9276 /Reaktor/IRC | |
parent | d40950a555d594365307fca7a5a23a360a15645c (diff) | |
parent | e2cf4fc92569487e21d096ac6879177aac8f73c1 (diff) |
filehooker: add tor_announce
Diffstat (limited to 'Reaktor/IRC')
-rw-r--r-- | Reaktor/IRC/ircasy.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index fd261ae9..57ec9189 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -85,7 +85,10 @@ class asybot(asychat): alarm(self.hammer_interval) def collect_incoming_data(self, data): - self.data += data.decode() + try: + self.data += data.decode() + except Exception as e: + print('error decoding message: ' + str(e)); def found_terminator(self): self.log.debug('<< %s' % self.data) @@ -173,8 +176,10 @@ class asybot(asychat): 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() + regex = search('(\d+)$', self.nickname) + if regex: + theint = int(regex.group(0)) + self.nickname = self.nickname.strip(str(theint)) + str(theint + 1) + else: + self.nickname = self.nickname + '0' + self.handle_connect() |