HoloUser will now update some attributes

This commit is contained in:
Profitroll 2022-12-16 22:58:32 +01:00
parent 3b71cb3d85
commit 8bb7c58c2a

View File

@ -100,6 +100,18 @@ class HoloUser():
self.locale = holo_user["tg_locale"] self.locale = holo_user["tg_locale"]
self.username = holo_user["tg_username"] self.username = holo_user["tg_username"]
if isinstance(user, User) and (self.name != user.first_name):
self.set("tg_name", user.first_name)
if isinstance(user, User) and (self.phone != user.phone_number):
self.set("tg_phone", user.phone_number)
if isinstance(user, User) and ((self.locale != user.language_code) and (user.language_code != None)):
self.set("tg_locale", user.language_code)
if isinstance(user, User) and (self.username != user.username):
self.set("tg_username", user.username)
def set(self, key: str, value: Any) -> None: def set(self, key: str, value: Any) -> None:
"""Set attribute data and save it into database """Set attribute data and save it into database