Fix zero-datetime not working in some systems · pythonfansx/pyrogram@8852756 · GitHub
Skip to content

Commit 8852756

Browse files
committed
Fix zero-datetime not working in some systems
1 parent aecdd49 commit 8852756

6 files changed

Lines changed: 12 additions & 8 deletions

File tree

pyrogram/methods/chats/ban_chat_member.py

Lines changed: 1 addition & 1 deletion

pyrogram/methods/chats/restrict_chat_member.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def restrict_chat_member(
3030
chat_id: Union[int, str],
3131
user_id: Union[int, str],
3232
permissions: "types.ChatPermissions",
33-
until_date: datetime = datetime.fromtimestamp(0)
33+
until_date: datetime = utils.zero_datetime()
3434
) -> "types.Chat":
3535
"""Restrict a user in a supergroup.
3636

pyrogram/methods/invite_links/edit_chat_invite_link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async def edit_chat_invite_link(
5151
5252
expire_date (:py:obj:`~datetime.datetime`, *optional*):
5353
Point in time when the link will expire.
54-
Defaults to None (no change), pass ``datetime.fromtimestamp(0)`` to set no expiration date.
54+
Defaults to None (no change), pass None to set no expiration date.
5555
5656
member_limit (``int``, *optional*):
5757
Maximum number of users that can be members of the chat simultaneously after joining the chat via this

pyrogram/methods/messages/get_chat_history.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def get_chunk(
3030
limit: int = 0,
3131
offset: int = 0,
3232
from_message_id: int = 0,
33-
from_date: datetime = datetime.fromtimestamp(0)
33+
from_date: datetime = utils.zero_datetime()
3434
):
3535
messages = await client.invoke(
3636
raw.functions.messages.GetHistory(
@@ -56,7 +56,7 @@ async def get_chat_history(
5656
limit: int = 0,
5757
offset: int = 0,
5858
offset_id: int = 0,
59-
offset_date: datetime = datetime.fromtimestamp(0)
59+
offset_date: datetime = utils.zero_datetime()
6060
) -> Optional[AsyncGenerator["types.Message", None]]:
6161
"""Get messages from a chat history.
6262

pyrogram/types/user_and_chats/chat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ async def set_photo(self, photo: str) -> bool:
514514
async def ban_member(
515515
self,
516516
user_id: Union[int, str],
517-
until_date: datetime = datetime.fromtimestamp(0)
517+
until_date: datetime = utils.zero_datetime()
518518
) -> Union["types.Message", bool]:
519519
"""Bound method *ban_member* of :obj:`~pyrogram.types.Chat`.
520520
@@ -602,7 +602,7 @@ async def restrict_member(
602602
self,
603603
user_id: Union[int, str],
604604
permissions: "types.ChatPermissions",
605-
until_date: datetime = datetime.fromtimestamp(0),
605+
until_date: datetime = utils.zero_datetime(),
606606
) -> "types.Chat":
607607
"""Bound method *unban_member* of :obj:`~pyrogram.types.Chat`.
608608

pyrogram/utils.py

Lines changed: 5 additions & 1 deletion

0 commit comments

Comments
 (0)