Skip to content

Commit df15481

Browse files
committed
yes
1 parent 7b4f12a commit df15481

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

pyrogram/methods/messages/get_chat_history.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def get_chunk(
3737
min_id: int = 0, # Inclusive
3838
max_id: int = 0, # Inclusive
3939
reverse: bool = False,
40-
) -> List[types.Message]:
40+
) -> List["types.Message"]:
4141
# Telegram API requires `offset_id` as starting point, boundaries alone don't work
4242
if (min_id or max_id) and not offset_id:
4343
if max_id:
@@ -75,12 +75,12 @@ async def get_chat_history(
7575
chat_id: Union[int, str],
7676
limit: int = 0,
7777
offset: int = 0,
78-
offset_id: int = 0,
78+
offset_id: int = None,
7979
offset_date: datetime = utils.zero_datetime(),
8080
min_id: int = 0,
8181
max_id: int = 0,
8282
reverse: bool = False,
83-
) -> AsyncIterator[types.Message]:
83+
) -> AsyncIterator["types.Message"]:
8484
"""Get messages from a chat history.
8585
8686
The messages are returned in reverse chronological order.
@@ -110,8 +110,8 @@ async def get_chat_history(
110110
Pass a date as offset to retrieve only older messages starting from that date.
111111
112112
min_id (``int``, *optional*):
113-
If a positive value was provided, the method will return only messages
114-
with IDs more than or equal to min_id (inclusive).
113+
If a positive value was provided, the method will return only messages
114+
with IDs more than or equal to min_id (inclusive).
115115
116116
max_id (``int``, *optional*):
117117
If a positive value was provided, the method will return only messages
@@ -129,10 +129,11 @@ async def get_chat_history(
129129
async for message in app.get_chat_history(chat_id):
130130
print(message.text)
131131
"""
132-
log.warning(
133-
"`offset_id` is deprecated and will be removed in future updates. " \
134-
"Use `min_id` or `max_id` instead."
135-
)
132+
if offset_id is not None:
133+
log.warning(
134+
"`offset_id` is deprecated and will be removed in future updates. " \
135+
"Use `min_id` or `max_id` instead."
136+
)
136137

137138
current: int = 0
138139
total: int = limit or (1 << 31) - 1

0 commit comments

Comments
 (0)