Skip to content
Snippets Groups Projects
Unverified Commit 969f2927 authored by Diicell's avatar Diicell Committed by GitHub
Browse files

FIX TelegramReader. (#12112)

FIX TelegramReader
parent 50413524
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,8 @@ class TelegramReader(BaseReader): ...@@ -58,8 +58,8 @@ class TelegramReader(BaseReader):
entity_name: str, entity_name: str,
post_id: Optional[int] = None, post_id: Optional[int] = None,
limit: Optional[int] = None, limit: Optional[int] = None,
start_date: Optional[datetime.date] = None, start_date: Optional[datetime.datetime] = None,
end_date: Optional[datetime.date] = None, end_date: Optional[datetime.datetime] = None,
) -> List[Document]: ) -> List[Document]:
"""Load posts/chat messages/comments from Telegram channels or chats. """Load posts/chat messages/comments from Telegram channels or chats.
...@@ -73,8 +73,8 @@ class TelegramReader(BaseReader): ...@@ -73,8 +73,8 @@ class TelegramReader(BaseReader):
the comments that reply to this ID will be returned.\ the comments that reply to this ID will be returned.\
Else will get posts/chat messages. Else will get posts/chat messages.
limit (int): Number of messages to be retrieved. limit (int): Number of messages to be retrieved.
start_date (datetime.date): Start date of the time period. start_date (datetime.datetime): Start date of the time period.
end_date (datetime.date): End date of the time period. end_date (datetime.datetime): End date of the time period.
""" """
return self.loop.run_until_complete( return self.loop.run_until_complete(
...@@ -92,8 +92,8 @@ class TelegramReader(BaseReader): ...@@ -92,8 +92,8 @@ class TelegramReader(BaseReader):
entity_name: str, entity_name: str,
post_id: Optional[int] = None, post_id: Optional[int] = None,
limit: Optional[int] = None, limit: Optional[int] = None,
start_date: Optional[datetime.date] = None, start_date: Optional[datetime.datetime] = None,
end_date: Optional[datetime.date] = None, end_date: Optional[datetime.datetime] = None,
) -> List[Document]: ) -> List[Document]:
"""Load posts/chat messages/comments from Telegram channels or chats. """Load posts/chat messages/comments from Telegram channels or chats.
...@@ -103,8 +103,8 @@ class TelegramReader(BaseReader): ...@@ -103,8 +103,8 @@ class TelegramReader(BaseReader):
the comments that reply to this ID will be returned.\ the comments that reply to this ID will be returned.\
Else will get posts/chat messages. Else will get posts/chat messages.
limit (int): Number of messages to be retrieved. limit (int): Number of messages to be retrieved.
start_date (datetime.date): Start date of the time period. start_date (datetime.datetime): Start date of the time period.
end_date (datetime.date): End date of the time period. end_date (datetime.datetime): End date of the time period.
""" """
import telethon import telethon
...@@ -121,7 +121,6 @@ class TelegramReader(BaseReader): ...@@ -121,7 +121,6 @@ class TelegramReader(BaseReader):
reply_to=post_id, reply_to=post_id,
limit=limit, limit=limit,
offset_date=end_date, offset_date=end_date,
reverse=True,
): ):
if message.date < start_date: if message.date < start_date:
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment