diff options
Diffstat (limited to 'Reaktor/IRC/ircasy.py')
-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() |