Use datetime type for date fields, update aiohttp version

This commit is contained in:
Alex Root Junior 2021-11-08 03:48:34 +02:00
parent 9b43a33b7f
commit e0ab7d8bd3
8 changed files with 218 additions and 73 deletions

View file

@ -1684,7 +1684,7 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
chat_id: Union[int, str],
name: Optional[str] = None,
expire_date: Optional[int] = None,
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
member_limit: Optional[int] = None,
creates_join_request: Optional[bool] = None,
request_timeout: Optional[int] = None,
@ -1716,7 +1716,7 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id: Union[int, str],
invite_link: str,
name: Optional[str] = None,
expire_date: Optional[int] = None,
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
member_limit: Optional[int] = None,
creates_join_request: Optional[bool] = None,
request_timeout: Optional[int] = None,

View file

@ -1,5 +1,6 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from ..types import ChatInviteLink
@ -22,7 +23,7 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[int] = None
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""

View file

@ -1,5 +1,6 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from ..types import ChatInviteLink
@ -24,7 +25,7 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""The invite link to edit"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[int] = None
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""

View file

@ -8,7 +8,6 @@ if TYPE_CHECKING:
from .photo_size import PhotoSize
# === Generated region: Audio ===
class Audio(TelegramObject):
"""
This object represents an audio file to be treated as music by the Telegram clients.
@ -34,6 +33,3 @@ class Audio(TelegramObject):
"""*Optional*. File size in bytes"""
thumb: Optional[PhotoSize] = None
"""*Optional*. Thumbnail of the album cover to which the music file belongs"""
# === End of generated region: Audio ===

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
import datetime
from typing import TYPE_CHECKING, Optional, Union
from .base import TelegramObject
@ -27,7 +28,7 @@ class ChatInviteLink(TelegramObject):
""":code:`True`, if the link is revoked"""
name: Optional[str] = None
"""*Optional*. Invite link name"""
expire_date: Optional[int] = None
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""*Optional*. Point in time (Unix timestamp) when the link will expire or has been expired"""
member_limit: Optional[int] = None
"""*Optional*. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from typing import List, Optional
import datetime
from typing import List, Optional, Union
from .base import TelegramObject
@ -20,7 +21,7 @@ class WebhookInfo(TelegramObject):
"""Number of updates awaiting delivery"""
ip_address: Optional[str] = None
"""*Optional*. Currently used webhook IP address"""
last_error_date: Optional[int] = None
last_error_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""*Optional*. Unix time for the most recent error that happened when trying to deliver an update via webhook"""
last_error_message: Optional[str] = None
"""*Optional*. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook"""