mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 11:53:08 +00:00
Fix downloading voice msg and remove unnecessary sort operation
This commit is contained in:
parent
b20fc378de
commit
5dbd7a843b
2 changed files with 2 additions and 5 deletions
|
@ -229,11 +229,9 @@ class MsgModel:
|
|||
log.info(f"adding {msg_id=} {message}")
|
||||
self.msgs[chat_id].append(message)
|
||||
msg_set.add(msg_id)
|
||||
|
||||
self.msgs[chat_id] = sorted(
|
||||
self.msgs[chat_id], key=lambda d: d["id"], reverse=True
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
def add_messages(self, chat_id: int, messages: Any) -> bool:
|
||||
|
@ -282,9 +280,7 @@ class MsgModel:
|
|||
messages = self._fetch_msgs_until_limit(chat_id, offset, limit)
|
||||
self.add_messages(chat_id, messages)
|
||||
|
||||
return sorted(self.msgs[chat_id], key=lambda d: d["id"], reverse=True)[
|
||||
offset:limit
|
||||
]
|
||||
return self.msgs[chat_id][offset:limit]
|
||||
|
||||
def send_message(self, chat_id: int, text: str) -> None:
|
||||
log.info("Sending msg")
|
||||
|
|
|
@ -85,6 +85,7 @@ class MsgProxy:
|
|||
"video",
|
||||
"recording",
|
||||
"sticker",
|
||||
"voice",
|
||||
):
|
||||
return None
|
||||
doc = self.get_doc(self.msg)
|
||||
|
|
Loading…
Reference in a new issue