Avoid sending unnecessary nick commands
This would get two Infobots in the same room stuck in a nick changing loop: The first updates its nick. The second receives a nick-event and updates its nick. The first receives a nick-event and updates its nick, and so on.
This commit is contained in:
parent
87628e1ff5
commit
c005e042cd
1 changed files with 3 additions and 1 deletions
|
|
@ -182,7 +182,9 @@ class InfoBot(yaboli.Bot):
|
|||
async def update_nick(self, room):
|
||||
users = await room.who()
|
||||
new_nick = self.format_nick(users)
|
||||
await room.nick(new_nick)
|
||||
|
||||
if room.session.nick != new_nick:
|
||||
await room.nick(new_nick)
|
||||
|
||||
async def on_connected(self, room):
|
||||
await self.update_nick(room)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue