fix: use own fork of Pyrogram to achieve chronological order of chat history

This commit is contained in:
Dineshkarthik 2022-07-20 16:10:25 +02:00
parent 9a2cef55bc
commit 6c48df4a27
No known key found for this signature in database
GPG key ID: E256EF0EECD6F201
2 changed files with 3 additions and 5 deletions

View file

@ -2,7 +2,6 @@
import asyncio import asyncio
import logging import logging
import os import os
from datetime import datetime as dt
from typing import List, Optional, Tuple, Union from typing import List, Optional, Tuple, Union
import pyrogram import pyrogram
@ -123,7 +122,7 @@ async def _get_media_meta(
_type, _type,
"{}_{}.{}".format( "{}_{}.{}".format(
_type, _type,
dt.utcfromtimestamp(media_obj.date).isoformat(), # type: ignore media_obj.date.isoformat(), # type: ignore
file_format, file_format,
), ),
) )
@ -311,8 +310,7 @@ async def begin_import(config: dict, pagination_limit: int) -> dict:
await client.start() await client.start()
last_read_message_id: int = config["last_read_message_id"] last_read_message_id: int = config["last_read_message_id"]
messages_iter = client.get_chat_history( messages_iter = client.get_chat_history(
config["chat_id"], config["chat_id"], offset_id=last_read_message_id, reverse=True
offset_id=last_read_message_id,
) )
messages_list: list = [] messages_list: list = []
pagination_count: int = 0 pagination_count: int = 0

View file

@ -1,4 +1,4 @@
Pyrogram==2.0.33 https://github.com/Dineshkarthik/pyrogram/archive/refs/heads/master.zip
PyYAML==6.0 PyYAML==6.0
rich==12.5.1 rich==12.5.1
TgCrypto==1.2.3 TgCrypto==1.2.3