Trying to fix AttributeError() on init
This commit is contained in:
parent
bc54abcc97
commit
a906c0a1cc
@ -100,17 +100,19 @@ class HoloUser():
|
||||
self.locale = holo_user["tg_locale"]
|
||||
self.username = holo_user["tg_username"]
|
||||
|
||||
if isinstance(user, User) and ((self.name != user.first_name) and (user.first_name is not None)):
|
||||
self.set("tg_name", user.first_name)
|
||||
if isinstance(user, User):
|
||||
|
||||
if isinstance(user, User) and ((self.phone != user.phone_number) and (user.phone_number is not None)):
|
||||
self.set("tg_phone", user.phone_number)
|
||||
if (self.name != user.first_name) and hasattr(user, "first_name") and (user.first_name is not None):
|
||||
self.set("tg_name", user.first_name)
|
||||
|
||||
if isinstance(user, User) and ((self.locale != user.language_code) and (user.language_code is not None)):
|
||||
self.set("tg_locale", user.language_code)
|
||||
if (self.phone != user.phone_number) and hasattr(user, "phone_number") and (user.phone_number is not None):
|
||||
self.set("tg_phone", user.phone_number)
|
||||
|
||||
if isinstance(user, User) and (self.username != user.username):
|
||||
self.set("tg_username", user.username)
|
||||
if (self.locale != user.language_code) and hasattr(user, "language_code") and (user.language_code is not None):
|
||||
self.set("tg_locale", user.language_code)
|
||||
|
||||
if (self.username != user.username) and hasattr(user, "username") and (user.username is not None):
|
||||
self.set("tg_username", user.username)
|
||||
|
||||
def set(self, key: str, value: Any) -> None:
|
||||
"""Set attribute data and save it into database
|
||||
@ -389,4 +391,7 @@ class HoloUser():
|
||||
col_tmp.update_one({"user": {"$eq": self.id}, "type": {"$eq": "application"}}, {"$set": {"application": progress["application"], "stage": progress["stage"]+1}})
|
||||
await msg.reply_text(locale(f"question{stage+1}", "message", locale=self.locale), reply_markup=ForceReply(placeholder=str(locale(f"question{stage+1}", "force_reply", locale=self.locale))))
|
||||
|
||||
logWrite(f"User {self.id} completed stage {stage} of application")
|
||||
logWrite(f"User {self.id} completed stage {stage} of application")
|
||||
|
||||
else:
|
||||
return
|
Reference in New Issue
Block a user