diff --git a/bot.py b/bot.py index 2f8df57..b3b1467 100755 --- a/bot.py +++ b/bot.py @@ -312,7 +312,7 @@ class Fulvia(irc.IRCClient): def left(self, channel, reason=""): - """Called when the leaves a channel.""" + """Called when the bot leaves a channel.""" line = "-!- " + self.nickname + " " + "[" + self.username + "@" line += self.host + "] has left " + channel + " [" + reason + "]" self.log(channel, line) @@ -384,6 +384,20 @@ class Fulvia(irc.IRCClient): self.channels.pop(channel) + def nickChanged(self, nick): + """Called when the bot changes it's nickname.""" + line = "-!- you are now known as " + nick + + user = self.users.pop(self.nickname) + self.users[nick] = user + for key, channel in self.channels.items(): + self.log(key, line) + + channel.rename_user(self.nickname, nick) + user.nick = nick + self.nickname = nick + + ## Actions the bot observes other users doing in the channel. ## These will get called automatically. @@ -444,7 +458,7 @@ class Fulvia(irc.IRCClient): def userRenamed(self, oldname, newname): - """Called wehn the bot sees a user change their nickname.""" + """Called when the bot sees a user change their nickname.""" line = "-!- " + oldname + " is now known as " + newname user = self.users.pop(oldname)