summaryrefslogtreecommitdiffstats
path: root/Reaktor
diff options
context:
space:
mode:
authortv <tv@iiso>2011-09-13 18:14:40 +0200
committertv <tv@iiso>2011-09-13 18:14:40 +0200
commited66e3572fe5f75ea9f6fb900e56d986f18f0a52 (patch)
treef9fd1e32ab0350ea78a81c207e6b86e8a95873a8 /Reaktor
parentf42893411ca1f6d04c1741962826c9004a2afa6a (diff)
//Reaktor/IRC nickname: increment suffix
Append or increment the bot's nickname suffix integer in order to connect to servers that already have users with the same nickname.
Diffstat (limited to 'Reaktor')
-rwxr-xr-xReaktor/IRC/asybot.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py
index 6e9df1d9..6a37daf1 100755
--- a/Reaktor/IRC/asybot.py
+++ b/Reaktor/IRC/asybot.py
@@ -69,6 +69,14 @@ class asybot(asychat):
elif command == 'PRIVMSG':
self.on_privmsg(prefix, command, params, rest)
+ 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()
+
# reset alarm
alarm(self.alarm_timeout)