Update update_chat_notifications to accept unix time only
This commit is contained in:
parent
673a618873
commit
1940c97c6d
@ -1,5 +1,4 @@
|
||||
from typing import Union
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from pyrogram.raw.functions.account import UpdateNotifySettings
|
||||
from pyrogram.raw.types import InputNotifyPeer, InputPeerNotifySettings
|
||||
@ -12,7 +11,7 @@ class UpdateChatNotifications(Scaffold):
|
||||
chat_id: Union[int, str],
|
||||
show_previews: bool = None,
|
||||
silent: bool = None,
|
||||
mute_until: Union[int, datetime, timedelta] = None
|
||||
mute_until: int = None
|
||||
) -> bool:
|
||||
"""Update the notification settings for the selected chat
|
||||
|
||||
@ -27,7 +26,7 @@ class UpdateChatNotifications(Scaffold):
|
||||
If the chat shall be muted.
|
||||
|
||||
mute_until (``int`` | ``datetime.datetime`` | ``datetime.timdelta``, *optional*):
|
||||
Unix timestamp, datetime or timedelta object that sets up when notifications shall be switched off.
|
||||
When notifications shall be switched off. Unix time.
|
||||
Default to forever.
|
||||
|
||||
Returns:
|
||||
@ -52,13 +51,6 @@ class UpdateChatNotifications(Scaffold):
|
||||
app.update_chat_notifications(chat_id, silent=False)
|
||||
"""
|
||||
|
||||
if isinstance(mute_until, datetime):
|
||||
mute_until = mute_until.timestamp()
|
||||
|
||||
if isinstance(mute_until, timedelta):
|
||||
now = datetime.now()
|
||||
mute_until = now.timestamp() + mute_until.total_seconds()
|
||||
|
||||
peer = await self.resolve_peer(chat_id)
|
||||
|
||||
r = await self.send(
|
||||
|
Loading…
Reference in New Issue
Block a user