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,6 +182,8 @@ class InfoBot(yaboli.Bot):
|
||||||
async def update_nick(self, room):
|
async def update_nick(self, room):
|
||||||
users = await room.who()
|
users = await room.who()
|
||||||
new_nick = self.format_nick(users)
|
new_nick = self.format_nick(users)
|
||||||
|
|
||||||
|
if room.session.nick != new_nick:
|
||||||
await room.nick(new_nick)
|
await room.nick(new_nick)
|
||||||
|
|
||||||
async def on_connected(self, room):
|
async def on_connected(self, room):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue