Add block argument to get_user_full_info call

This commit is contained in:
Paul Nameless 2020-07-23 17:52:05 +08:00
parent fb11dafb38
commit d674c1d430
3 changed files with 6 additions and 5 deletions

View file

@ -77,7 +77,7 @@ class Controller:
self.chat_size = 0.5
@bind(msg_handler, ["u"])
def user_innfo(self) -> None:
def user_info(self) -> None:
"""Show user profile"""
msg = MsgProxy(self.model.current_msg)
user_id = msg.sender_id

View file

@ -615,8 +615,7 @@ class UserModel:
if user.get("full_info"):
return user["full_info"]
result = self.tg.get_user_full_info(user_id)
result.wait()
result = self.tg.get_user_full_info(user_id, block=True)
if result.error:
log.warning(f"get user full info error: {result.error_info}")
return {}

View file

@ -380,12 +380,14 @@ class Tdlib(Telegram):
}
return self._send_data(data)
def get_user_full_info(self, user_id: int) -> AsyncResult:
def get_user_full_info(
self, user_id: int, block: bool = False
) -> AsyncResult:
data = {
"@type": "getUserFullInfo",
"user_id": user_id,
}
return self._send_data(data)
return self._send_data(data, block=block)
def get_chat_type(chat: Dict[str, Any]) -> Optional[ChatType]: