From 8bb7c58c2a67cb516838e09b09297d730df1713a Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Fri, 16 Dec 2022 22:58:32 +0100 Subject: [PATCH] HoloUser will now update some attributes --- classes/holo_user.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/classes/holo_user.py b/classes/holo_user.py index c0879f0..3de2b1b 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -99,6 +99,18 @@ class HoloUser(): self.phone = holo_user["tg_phone"] self.locale = holo_user["tg_locale"] 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: """Set attribute data and save it into database