Skip to content

Commit

Permalink
Update to TDLib 1.7.10 (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
irondrondron authored Apr 20, 2022
1 parent c2f5fca commit 7f9dd9b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tg/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def notify_for_message(self, chat_id: int, msg: MsgProxy) -> None:
return

# notify
if self.model.is_me(msg["sender"].get("user_id")):
if self.model.is_me(msg["sender_id"].get("user_id")):
return
user = self.model.users.get_user(msg.sender_id)
name = f"{user['first_name']} {user['last_name']}"
Expand Down
2 changes: 1 addition & 1 deletion tg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def edit_message(self, text: str) -> bool:
return False

def can_be_deleted(self, chat_id: int, msg: Dict[str, Any]) -> bool:
c_id = msg["sender"].get("chat_id") or msg["sender"].get("user_id")
c_id = msg["sender_id"].get("chat_id") or msg["sender_id"].get("user_id")
if chat_id == c_id:
return msg["can_be_deleted_only_for_self"]
return msg["can_be_deleted_for_all_users"]
Expand Down
2 changes: 1 addition & 1 deletion tg/msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def chat_id(self) -> int:

@property
def sender_id(self) -> int:
return self.msg["sender"].get("user_id") or self.msg["sender"].get(
return self.msg["sender_id"].get("user_id") or self.msg["sender_id"].get(
"chat_id"
)

Expand Down
6 changes: 3 additions & 3 deletions tg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ def _get_flags(self, chat: Dict[str, Any]) -> str:
msg = chat.get("last_message")
if (
msg
and self.model.is_me(msg["sender"].get("user_id"))
and self.model.is_me(msg["sender_id"].get("user_id"))
and msg["id"] > chat["last_read_outbox_message_id"]
and not self.model.is_me(chat["id"])
):
# last msg haven't been seen by recipient
flags.append("unseen")
elif (
msg
and self.model.is_me(msg["sender"].get("user_id"))
and self.model.is_me(msg["sender_id"].get("user_id"))
and msg["id"] <= chat["last_read_outbox_message_id"]
):
flags.append("seen")
Expand Down Expand Up @@ -610,7 +610,7 @@ def get_last_msg(
if not last_msg:
return None, "<No messages yet>"
return (
last_msg["sender"].get("user_id"),
last_msg["sender_id"].get("user_id"),
parse_content(MsgProxy(last_msg), users),
)

Expand Down

0 comments on commit 7f9dd9b

Please sign in to comment.