From 0c2d0c14048057feb01e2bb76f92eed64f331911 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 15 Mar 2014 01:04:16 +0100 Subject: ircasy: new nickinuse function --- IRC/ircasy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'IRC') diff --git a/IRC/ircasy.py b/IRC/ircasy.py index ac07101..4dfff39 100644 --- a/IRC/ircasy.py +++ b/IRC/ircasy.py @@ -176,8 +176,9 @@ 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 = re.search('(\d+)$', self.nickname) + if regex: + theint = int(regex.group(0)) + self.nickname = self.nickname.strip(theint) + str(theint + 1) + else self.nickname = self.nickname + '0' + self.handle_connect() -- cgit v1.2.3