summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2014-03-15 01:04:16 +0100
committerlassulus <lassulus@googlemail.com>2014-03-15 01:04:16 +0100
commita9633ea16310f99c7a39dcd8c4a1c7bb05326135 (patch)
tree86724d33a42b20943e8613eb5c62f691874859fb /Reaktor/IRC
parentb657927cf0b6420683c261ff32434b2b8b2cdf70 (diff)
ircasy: new nickinuse function
Diffstat (limited to 'Reaktor/IRC')
-rw-r--r--Reaktor/IRC/ircasy.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py
index ac071013..4dfff390 100644
--- a/Reaktor/IRC/ircasy.py
+++ b/Reaktor/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()