2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Rename get_history's "reversed" parameter to "reverse"

It was colliding with the built-in "reversed" function
This commit is contained in:
Dan 2019-01-04 14:36:42 +01:00
parent 36f987e979
commit fe4e8c5a42

View File

@ -30,7 +30,7 @@ class GetHistory(BaseClient):
offset: int = 0, offset: int = 0,
offset_id: int = 0, offset_id: int = 0,
offset_date: int = 0, offset_date: int = 0,
reversed: bool = False): reverse: bool = False):
"""Use this method to retrieve the history of a chat. """Use this method to retrieve the history of a chat.
You can get up to 100 messages at once. You can get up to 100 messages at once.
@ -55,7 +55,7 @@ class GetHistory(BaseClient):
offset_date (``int``, *optional*): offset_date (``int``, *optional*):
Pass a date in Unix time as offset to retrieve only older messages starting from that date. Pass a date in Unix time as offset to retrieve only older messages starting from that date.
reversed (``bool``, *optional*): reverse (``bool``, *optional*):
Pass True to retrieve the messages in reversed order (from older to most recent). Pass True to retrieve the messages in reversed order (from older to most recent).
Returns: Returns:
@ -72,7 +72,7 @@ class GetHistory(BaseClient):
peer=self.resolve_peer(chat_id), peer=self.resolve_peer(chat_id),
offset_id=offset_id, offset_id=offset_id,
offset_date=offset_date, offset_date=offset_date,
add_offset=offset - (limit if reversed else 0), add_offset=offset - (limit if reverse else 0),
limit=limit, limit=limit,
max_id=0, max_id=0,
min_id=0, min_id=0,
@ -81,7 +81,7 @@ class GetHistory(BaseClient):
) )
) )
if reversed: if reverse:
messages.messages.reverse() messages.messages.reverse()
return messages return messages