Change user nickname before firing (received/self).nick events

This commit is contained in:
jesopo 2019-05-12 22:07:04 +01:00
parent 8c3ea677ec
commit 3e9d628d64

View file

@ -40,6 +40,9 @@ def nick(events, event):
user = event["server"].get_user(event["prefix"].nickname)
old_nickname = user.nickname
user.set_nickname(new_nickname)
event["server"].change_user_nickname(old_nickname, new_nickname)
if not event["server"].is_own_nickname(event["prefix"].nickname):
events.on("received.nick").call(new_nickname=new_nickname,
old_nickname=old_nickname, user=user, server=event["server"])
@ -48,9 +51,6 @@ def nick(events, event):
events.on("self.nick").call(server=event["server"],
new_nickname=new_nickname, old_nickname=old_nickname)
user.set_nickname(new_nickname)
event["server"].change_user_nickname(old_nickname, new_nickname)
def away(events, event):
user = event["server"].get_user(event["prefix"].nickname)
message = event["args"].get(0)