Refactor: Introduce Union types for streamlined type handling (#1649)

* Refactor: Introduce Union types for streamlined type handling

Implemented Union types across various modules to consolidate and simplify type annotations. This change replaces repetitive union declarations with reusable Union aliases, improving code readability and maintainability. Updates applied to affected classes, methods, and imports accordingly.

* Refactor unions into type aliases for better reusability

Replaced inline `Union` types with predefined aliases like `MediaUnion`, `ReplyMarkupUnion`, and `ChatIdUnion`. Simplifies type annotations, improves code readability, and reduces duplication. Added `media_union.py` for grouping related media types.

* Refactor type unions with ResultChatMemberUnion and ResultMenuButtonUnion

Replaced verbose type definitions of chat member and menu button unions with `ResultChatMemberUnion` and `ResultMenuButtonUnion` for improved readability and maintainability. Updated relevant methods, modules, and documentation to use the new type aliases consistently.

* Added changelog
This commit is contained in:
Alex Root Junior 2025-03-08 02:19:57 +02:00 committed by GitHub
parent 843c1dec7c
commit cd4e811856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
173 changed files with 1452 additions and 2562 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,32 +1,10 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
from ..types import (
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultContact,
InlineQueryResultDocument,
InlineQueryResultGame,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultsButton,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
)
from ..types import InlineQueryResultsButton, InlineQueryResultUnion
from .base import TelegramMethod
@ -44,30 +22,7 @@ class AnswerInlineQuery(TelegramMethod[bool]):
inline_query_id: str
"""Unique identifier for the answered query"""
results: list[
Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
]
results: list[InlineQueryResultUnion]
"""A JSON-serialized array of results for the inline query"""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
@ -96,30 +51,7 @@ class AnswerInlineQuery(TelegramMethod[bool]):
__pydantic__self__,
*,
inline_query_id: str,
results: list[
Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
],
results: list[InlineQueryResultUnion],
cache_time: Optional[int] = None,
is_personal: Optional[bool] = None,
next_offset: Optional[str] = None,

View file

@ -1,30 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import (
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultContact,
InlineQueryResultDocument,
InlineQueryResultGame,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
SentWebAppMessage,
)
from ..types import InlineQueryResultUnion, SentWebAppMessage
from .base import TelegramMethod
@ -40,28 +18,7 @@ class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
web_app_query_id: str
"""Unique identifier for the query to be answered"""
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
result: InlineQueryResultUnion
"""A JSON-serialized object describing the message to be sent"""
if TYPE_CHECKING:
@ -72,28 +29,7 @@ class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
__pydantic__self__,
*,
web_app_query_id: str,
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
],
result: InlineQueryResultUnion,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class ApproveChatJoinRequest(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "approveChatJoinRequest"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -25,7 +26,7 @@ class ApproveChatJoinRequest(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], user_id: int, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, user_id: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,8 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, DateTimeUnion
from .base import TelegramMethod
@ -16,11 +16,11 @@ class BanChatMember(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "banChatMember"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
until_date: Optional[DateTimeUnion] = None
"""Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."""
revoke_messages: Optional[bool] = None
"""Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels."""
@ -32,9 +32,9 @@ class BanChatMember(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
until_date: Optional[DateTimeUnion] = None,
revoke_messages: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class BanChatSenderChat(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "banChatSenderChat"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
@ -27,7 +28,7 @@ class BanChatSenderChat(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
sender_chat_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -66,7 +66,7 @@ class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC
return {k: v for k, v in values.items() if not isinstance(v, UNSET_TYPE)}
if TYPE_CHECKING:
__returning__: ClassVar[type]
__returning__: ClassVar[Any]
__api_method__: ClassVar[str]
else:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class CloseForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "closeForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
@ -27,7 +28,7 @@ class CloseForumTopic(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_thread_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class CloseGeneralForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "closeGeneralForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class CloseGeneralForumTopic(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,18 +1,16 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
DateTimeUnion,
MessageEntity,
MessageId,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,15 +26,15 @@ class CopyMessage(TelegramMethod[MessageId]):
__returning__ = MessageId
__api_method__ = "copyMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: Union[int, str]
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int
"""Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
video_start_timestamp: Optional[DateTimeUnion] = None
"""New start timestamp for the copied video in the message"""
caption: Optional[str] = None
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
@ -54,9 +52,7 @@ class CopyMessage(TelegramMethod[MessageId]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -78,13 +74,11 @@ class CopyMessage(TelegramMethod[MessageId]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
video_start_timestamp: Optional[
Union[datetime.datetime, datetime.timedelta, int]
] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
@ -95,9 +89,7 @@ class CopyMessage(TelegramMethod[MessageId]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import MessageId
from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod
@ -14,9 +14,9 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
__returning__ = list[MessageId]
__api_method__ = "copyMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: Union[int, str]
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
@ -36,8 +36,8 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,

View file

@ -1,9 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatInviteLink
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
@ -17,11 +16,11 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
__returning__ = ChatInviteLink
__api_method__ = "createChatInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""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[Union[datetime.datetime, datetime.timedelta, int]] = None
expire_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
@ -35,9 +34,9 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
name: Optional[str] = None,
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
expire_date: Optional[DateTimeUnion] = None,
member_limit: Optional[int] = None,
creates_join_request: Optional[bool] = None,
**__pydantic_kwargs: Any,

View file

@ -1,9 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatInviteLink
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
@ -17,9 +16,9 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
__returning__ = ChatInviteLink
__api_method__ = "createChatSubscriptionInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)"""
subscription_period: Union[datetime.datetime, datetime.timedelta, int]
subscription_period: DateTimeUnion
"""The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."""
subscription_price: int
"""The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500"""
@ -33,8 +32,8 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
subscription_period: Union[datetime.datetime, datetime.timedelta, int],
chat_id: ChatIdUnion,
subscription_period: DateTimeUnion,
subscription_price: int,
name: Optional[str] = None,
**__pydantic_kwargs: Any,

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ForumTopic
from ..types import ChatIdUnion, ForumTopic
from .base import TelegramMethod
@ -16,7 +16,7 @@ class CreateForumTopic(TelegramMethod[ForumTopic]):
__returning__ = ForumTopic
__api_method__ = "createForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str
"""Topic name, 1-128 characters"""
@ -32,7 +32,7 @@ class CreateForumTopic(TelegramMethod[ForumTopic]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
name: str,
icon_color: Optional[int] = None,
icon_custom_emoji_id: Optional[str] = None,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class DeclineChatJoinRequest(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "declineChatJoinRequest"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -25,7 +26,7 @@ class DeclineChatJoinRequest(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], user_id: int, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, user_id: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class DeleteChatPhoto(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteChatPhoto"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class DeleteChatPhoto(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class DeleteChatStickerSet(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteChatStickerSet"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class DeleteChatStickerSet(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class DeleteForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
@ -27,7 +28,7 @@ class DeleteForumTopic(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_thread_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -33,7 +34,7 @@ class DeleteMessage(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the message to delete"""
@ -43,11 +44,7 @@ class DeleteMessage(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
message_id: int,
**__pydantic_kwargs: Any,
__pydantic__self__, *, chat_id: ChatIdUnion, message_id: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,5 +1,6 @@
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -13,7 +14,7 @@ class DeleteMessages(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages to delete. See :class:`aiogram.methods.delete_message.DeleteMessage` for limitations on which messages can be deleted"""
@ -25,7 +26,7 @@ class DeleteMessages(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_ids: list[int],
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,16 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import (
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from ..types import BotCommandScopeUnion
from .base import TelegramMethod
@ -24,17 +16,7 @@ class DeleteMyCommands(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMyCommands"
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
scope: Optional[BotCommandScopeUnion] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
@ -46,17 +28,7 @@ class DeleteMyCommands(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,9 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatInviteLink
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
@ -17,13 +16,13 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
__returning__ = ChatInviteLink
__api_method__ = "editChatInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to edit"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
expire_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
@ -37,10 +36,10 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
invite_link: str,
name: Optional[str] = None,
expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
expire_date: Optional[DateTimeUnion] = None,
member_limit: Optional[int] = None,
creates_join_request: Optional[bool] = None,
**__pydantic_kwargs: Any,

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatInviteLink
from ..types import ChatIdUnion, ChatInviteLink
from .base import TelegramMethod
@ -16,7 +16,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
__returning__ = ChatInviteLink
__api_method__ = "editChatSubscriptionInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to edit"""
@ -30,7 +30,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
invite_link: str,
name: Optional[str] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class EditForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "editForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
@ -31,7 +32,7 @@ class EditForumTopic(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_thread_id: int,
name: Optional[str] = None,
icon_custom_emoji_id: Optional[str] = None,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class EditGeneralForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "editGeneralForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str
"""New topic name, 1-128 characters"""
@ -25,7 +26,7 @@ class EditGeneralForumTopic(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], name: str, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, name: str, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -3,7 +3,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import InlineKeyboardMarkup, Message, MessageEntity
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message, MessageEntity
from .base import TelegramMethod
@ -19,7 +19,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
@ -44,7 +44,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
__pydantic__self__,
*,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
caption: Optional[str] = None,

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod
@ -22,7 +22,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""Longitude of new location"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
@ -49,7 +49,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
latitude: float,
longitude: float,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
live_period: Optional[int] = None,

View file

@ -2,15 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
InlineKeyboardMarkup,
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
Message,
)
from ..types import ChatIdUnion, InlineKeyboardMarkup, InputMediaUnion, Message
from .base import TelegramMethod
@ -24,13 +16,11 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool]
__api_method__ = "editMessageMedia"
media: Union[
InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
]
media: InputMediaUnion
"""A JSON-serialized object for a new media content of the message"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
@ -46,15 +36,9 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
def __init__(
__pydantic__self__,
*,
media: Union[
InputMediaAnimation,
InputMediaDocument,
InputMediaAudio,
InputMediaPhoto,
InputMediaVideo,
],
media: InputMediaUnion,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod
@ -18,7 +18,7 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
@ -35,7 +35,7 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
__pydantic__self__,
*,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import InlineKeyboardMarkup, LinkPreviewOptions, Message, MessageEntity
from ..types import (
ChatIdUnion,
InlineKeyboardMarkup,
LinkPreviewOptions,
Message,
MessageEntity,
)
from .base import TelegramMethod
@ -23,7 +29,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
"""New text of the message, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
@ -54,7 +60,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
*,
text: str,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -17,7 +18,7 @@ class ExportChatInviteLink(TelegramMethod[str]):
__returning__ = str
__api_method__ = "exportChatInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -25,7 +26,7 @@ class ExportChatInviteLink(TelegramMethod[str]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,10 +1,9 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import Message
from ..types import ChatIdUnion, DateTimeUnion, Message
from .base import TelegramMethod
@ -18,15 +17,15 @@ class ForwardMessage(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "forwardMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: Union[int, str]
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int
"""Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
video_start_timestamp: Optional[DateTimeUnion] = None
"""New start timestamp for the forwarded video in the message"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
@ -40,13 +39,11 @@ class ForwardMessage(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
video_start_timestamp: Optional[
Union[datetime.datetime, datetime.timedelta, int]
] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
**__pydantic_kwargs: Any,

View file

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import MessageId
from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod
@ -14,9 +14,9 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
__returning__ = list[MessageId]
__api_method__ = "forwardMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: Union[int, str]
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
@ -34,8 +34,8 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatFullInfo
from ..types import ChatFullInfo, ChatIdUnion
from .base import TelegramMethod
@ -16,7 +16,7 @@ class GetChat(TelegramMethod[ChatFullInfo]):
__returning__ = ChatFullInfo
__api_method__ = "getChat"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -24,7 +24,7 @@ class GetChat(TelegramMethod[ChatFullInfo]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,51 +1,22 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import (
ChatMemberAdministrator,
ChatMemberBanned,
ChatMemberLeft,
ChatMemberMember,
ChatMemberOwner,
ChatMemberRestricted,
)
from ..types import ChatIdUnion, ResultChatMemberUnion
from .base import TelegramMethod
class GetChatAdministrators(
TelegramMethod[
list[
Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
]
]
):
class GetChatAdministrators(TelegramMethod[list[ResultChatMemberUnion]]):
"""
Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects.
Source: https://core.telegram.org/bots/api#getchatadministrators
"""
__returning__ = list[
Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
]
__returning__ = list[ResultChatMemberUnion]
__api_method__ = "getChatAdministrators"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -53,7 +24,7 @@ class GetChatAdministrators(
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,47 +1,22 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import (
ChatMemberAdministrator,
ChatMemberBanned,
ChatMemberLeft,
ChatMemberMember,
ChatMemberOwner,
ChatMemberRestricted,
)
from ..types import ChatIdUnion, ResultChatMemberUnion
from .base import TelegramMethod
class GetChatMember(
TelegramMethod[
Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
]
):
class GetChatMember(TelegramMethod[ResultChatMemberUnion]):
"""
Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Source: https://core.telegram.org/bots/api#getchatmember
"""
__returning__ = Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
__returning__ = ResultChatMemberUnion
__api_method__ = "getChatMember"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -51,7 +26,7 @@ class GetChatMember(
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], user_id: int, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, user_id: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class GetChatMemberCount(TelegramMethod[int]):
__returning__ = int
__api_method__ = "getChatMemberCount"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class GetChatMemberCount(TelegramMethod[int]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,21 +1,19 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from ..types import ResultMenuButtonUnion
from .base import TelegramMethod
class GetChatMenuButton(
TelegramMethod[Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]]
):
class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]):
"""
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns :class:`aiogram.types.menu_button.MenuButton` on success.
Source: https://core.telegram.org/bots/api#getchatmenubutton
"""
__returning__ = Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]
__returning__ = ResultMenuButtonUnion
__api_method__ = "getChatMenuButton"
chat_id: Optional[int] = None

View file

@ -1,17 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from ..types import BotCommand, BotCommandScopeUnion
from .base import TelegramMethod
@ -25,17 +16,7 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]):
__returning__ = list[BotCommand]
__api_method__ = "getMyCommands"
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
scope: Optional[BotCommandScopeUnion] = None
"""A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
@ -47,17 +28,7 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]):
def __init__(
__pydantic__self__,
*,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import UserChatBoosts
from ..types import ChatIdUnion, UserChatBoosts
from .base import TelegramMethod
@ -14,7 +14,7 @@ class GetUserChatBoosts(TelegramMethod[UserChatBoosts]):
__returning__ = UserChatBoosts
__api_method__ = "getUserChatBoosts"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -24,7 +24,7 @@ class GetUserChatBoosts(TelegramMethod[UserChatBoosts]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], user_id: int, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, user_id: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class HideGeneralForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "hideGeneralForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class HideGeneralForumTopic(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class LeaveChat(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "leaveChat"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class LeaveChat(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class PinChatMessage(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "pinChatMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of a message to pin"""
@ -31,7 +32,7 @@ class PinChatMessage(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_id: int,
business_connection_id: Optional[str] = None,
disable_notification: Optional[bool] = None,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class PromoteChatMember(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "promoteChatMember"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -57,7 +58,7 @@ class PromoteChatMember(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
is_anonymous: Optional[bool] = None,
can_manage_chat: Optional[bool] = None,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class RemoveChatVerification(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "removeChatVerification"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class RemoveChatVerification(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class ReopenForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "reopenForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
@ -27,7 +28,7 @@ class ReopenForumTopic(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_thread_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class ReopenGeneralForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "reopenGeneralForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class ReopenGeneralForumTopic(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,9 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatPermissions
from ..types import ChatIdUnion, ChatPermissions, DateTimeUnion
from .base import TelegramMethod
@ -17,7 +16,7 @@ class RestrictChatMember(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "restrictChatMember"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -25,7 +24,7 @@ class RestrictChatMember(TelegramMethod[bool]):
"""A JSON-serialized object for new user permissions"""
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
until_date: Optional[DateTimeUnion] = None
"""Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""
if TYPE_CHECKING:
@ -35,11 +34,11 @@ class RestrictChatMember(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
permissions: ChatPermissions,
use_independent_chat_permissions: Optional[bool] = None,
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
until_date: Optional[DateTimeUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatInviteLink
from ..types import ChatIdUnion, ChatInviteLink
from .base import TelegramMethod
@ -16,7 +16,7 @@ class RevokeChatInviteLink(TelegramMethod[ChatInviteLink]):
__returning__ = ChatInviteLink
__api_method__ = "revokeChatInviteLink"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier of the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to revoke"""
@ -26,11 +26,7 @@ class RevokeChatInviteLink(TelegramMethod[ChatInviteLink]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
invite_link: str,
**__pydantic_kwargs: Any,
__pydantic__self__, *, chat_id: ChatIdUnion, invite_link: str, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,28 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types.inline_query_result_article import InlineQueryResultArticle
from ..types.inline_query_result_audio import InlineQueryResultAudio
from ..types.inline_query_result_cached_audio import InlineQueryResultCachedAudio
from ..types.inline_query_result_cached_document import InlineQueryResultCachedDocument
from ..types.inline_query_result_cached_gif import InlineQueryResultCachedGif
from ..types.inline_query_result_cached_mpeg4_gif import InlineQueryResultCachedMpeg4Gif
from ..types.inline_query_result_cached_photo import InlineQueryResultCachedPhoto
from ..types.inline_query_result_cached_sticker import InlineQueryResultCachedSticker
from ..types.inline_query_result_cached_video import InlineQueryResultCachedVideo
from ..types.inline_query_result_cached_voice import InlineQueryResultCachedVoice
from ..types.inline_query_result_contact import InlineQueryResultContact
from ..types.inline_query_result_document import InlineQueryResultDocument
from ..types.inline_query_result_game import InlineQueryResultGame
from ..types.inline_query_result_gif import InlineQueryResultGif
from ..types.inline_query_result_location import InlineQueryResultLocation
from ..types.inline_query_result_mpeg4_gif import InlineQueryResultMpeg4Gif
from ..types.inline_query_result_photo import InlineQueryResultPhoto
from ..types.inline_query_result_venue import InlineQueryResultVenue
from ..types.inline_query_result_video import InlineQueryResultVideo
from ..types.inline_query_result_voice import InlineQueryResultVoice
from ..types.prepared_inline_message import PreparedInlineMessage
from ..types import InlineQueryResultUnion, PreparedInlineMessage
from .base import TelegramMethod
@ -38,28 +18,7 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
user_id: int
"""Unique identifier of the target user that can use the prepared message"""
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
result: InlineQueryResultUnion
"""A JSON-serialized object describing the message to be sent"""
allow_user_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to private chats with users"""
@ -78,28 +37,7 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
__pydantic__self__,
*,
user_id: int,
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
],
result: InlineQueryResultUnion,
allow_user_chats: Optional[bool] = None,
allow_bot_chats: Optional[bool] = None,
allow_group_chats: Optional[bool] = None,

View file

@ -6,13 +6,12 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,9 +27,9 @@ class SendAnimation(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendAnimation"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
animation: Union[InputFile, str]
animation: InputFileUnion
"""Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -64,9 +63,7 @@ class SendAnimation(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -88,8 +85,8 @@ class SendAnimation(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
animation: Union[InputFile, str],
chat_id: ChatIdUnion,
animation: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
@ -108,9 +105,7 @@ class SendAnimation(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -6,13 +6,12 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -29,9 +28,9 @@ class SendAudio(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendAudio"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
audio: Union[InputFile, str]
audio: InputFileUnion
"""Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -61,9 +60,7 @@ class SendAudio(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -85,8 +82,8 @@ class SendAudio(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
audio: Union[InputFile, str],
chat_id: ChatIdUnion,
audio: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
@ -101,9 +98,7 @@ class SendAudio(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -19,7 +20,7 @@ class SendChatAction(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "sendChatAction"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
@ -35,7 +36,7 @@ class SendChatAction(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
action: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,

View file

@ -5,14 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
@ -26,7 +19,7 @@ class SendContact(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendContact"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
phone_number: str
"""Contact's phone number"""
@ -50,9 +43,7 @@ class SendContact(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -74,7 +65,7 @@ class SendContact(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
phone_number: str,
first_name: str,
business_connection_id: Optional[str] = None,
@ -86,9 +77,7 @@ class SendContact(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -5,14 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
@ -26,7 +19,7 @@ class SendDice(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendDice"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -44,9 +37,7 @@ class SendDice(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -68,7 +59,7 @@ class SendDice(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
@ -77,9 +68,7 @@ class SendDice(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -6,13 +6,12 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,9 +27,9 @@ class SendDocument(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendDocument"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
document: Union[InputFile, str]
document: InputFileUnion
"""File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -56,9 +55,7 @@ class SendDocument(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -80,8 +77,8 @@ class SendDocument(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
document: Union[InputFile, str],
chat_id: ChatIdUnion,
document: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
@ -94,9 +91,7 @@ class SendDocument(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from ..types.message_entity import MessageEntity
from .base import TelegramMethod
@ -20,7 +21,7 @@ class SendGift(TelegramMethod[bool]):
"""Identifier of the gift"""
user_id: Optional[int] = None
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift."""
pay_for_upgrade: Optional[bool] = None
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
@ -40,7 +41,7 @@ class SendGift(TelegramMethod[bool]):
*,
gift_id: str,
user_id: Optional[int] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
pay_for_upgrade: Optional[bool] = None,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import InlineKeyboardMarkup, LabeledPrice, Message, ReplyParameters
from ..types import (
ChatIdUnion,
InlineKeyboardMarkup,
LabeledPrice,
Message,
ReplyParameters,
)
from .base import TelegramMethod
@ -19,7 +25,7 @@ class SendInvoice(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendInvoice"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
title: str
"""Product name, 1-32 characters"""
@ -97,7 +103,7 @@ class SendInvoice(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
title: str,
description: str,
payload: str,

View file

@ -5,14 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
@ -26,7 +19,7 @@ class SendLocation(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendLocation"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
latitude: float
"""Latitude of the location"""
@ -54,9 +47,7 @@ class SendLocation(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -78,7 +69,7 @@ class SendLocation(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
latitude: float,
longitude: float,
business_connection_id: Optional[str] = None,
@ -92,9 +83,7 @@ class SendLocation(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -5,14 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
Message,
ReplyParameters,
)
from ..types import ChatIdUnion, MediaUnion, Message, ReplyParameters
from .base import TelegramMethod
@ -26,9 +19,9 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
__returning__ = list[Message]
__api_method__ = "sendMediaGroup"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
media: list[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]]
media: list[MediaUnion]
"""A JSON-serialized array describing messages to be sent, must include 2-10 items"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -64,10 +57,8 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
media: list[
Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]
],
chat_id: ChatIdUnion,
media: list[MediaUnion],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,

View file

@ -6,13 +6,11 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
LinkPreviewOptions,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,7 +26,7 @@ class SendMessage(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
text: str
"""Text of the message to be sent, 1-4096 characters after entities parsing"""
@ -52,9 +50,7 @@ class SendMessage(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -83,7 +79,7 @@ class SendMessage(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
text: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
@ -97,9 +93,7 @@ class SendMessage(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
"link_preview_is_disabled"

View file

@ -1,16 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputPaidMediaPhoto,
InputPaidMediaVideo,
ChatIdUnion,
InputPaidMediaUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -26,11 +23,11 @@ class SendPaidMedia(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendPaidMedia"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance."""
star_count: int
"""The number of Telegram Stars that must be paid to buy access to the media; 1-2500"""
media: list[Union[InputPaidMediaPhoto, InputPaidMediaVideo]]
media: list[InputPaidMediaUnion]
"""A JSON-serialized array describing the media to be sent; up to 10 items"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -52,9 +49,7 @@ class SendPaidMedia(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
if TYPE_CHECKING:
@ -64,9 +59,9 @@ class SendPaidMedia(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
star_count: int,
media: list[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
media: list[InputPaidMediaUnion],
business_connection_id: Optional[str] = None,
payload: Optional[str] = None,
caption: Optional[str] = None,
@ -77,9 +72,7 @@ class SendPaidMedia(TelegramMethod[Message]):
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -6,13 +6,11 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputFile,
ChatIdUnion,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,9 +26,9 @@ class SendPhoto(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendPhoto"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
photo: Union[InputFile, str]
photo: InputFileUnion
"""Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -56,9 +54,7 @@ class SendPhoto(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -80,8 +76,8 @@ class SendPhoto(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
photo: Union[InputFile, str],
chat_id: ChatIdUnion,
photo: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
@ -96,9 +92,7 @@ class SendPhoto(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,19 +1,17 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputPollOption,
ChatIdUnion,
DateTimeUnion,
InputPollOptionUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -29,11 +27,11 @@ class SendPoll(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendPoll"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
question: str
"""Poll question, 1-300 characters"""
options: list[Union[InputPollOption, str]]
options: list[InputPollOptionUnion]
"""A JSON-serialized list of 2-10 answer options"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -59,7 +57,7 @@ class SendPoll(TelegramMethod[Message]):
"""A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of *explanation_parse_mode*"""
open_period: Optional[int] = None
"""Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*."""
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
close_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with *open_period*."""
is_closed: Optional[bool] = None
"""Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview."""
@ -73,9 +71,7 @@ class SendPoll(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -97,9 +93,9 @@ class SendPoll(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
question: str,
options: list[Union[InputPollOption, str]],
options: list[InputPollOptionUnion],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -112,16 +108,14 @@ class SendPoll(TelegramMethod[Message]):
explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
explanation_entities: Optional[list[MessageEntity]] = None,
open_period: Optional[int] = None,
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
close_date: Optional[DateTimeUnion] = None,
is_closed: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -6,12 +6,10 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputFile,
ChatIdUnion,
InputFileUnion,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -27,9 +25,9 @@ class SendSticker(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendSticker"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sticker: Union[InputFile, str]
sticker: InputFileUnion
"""Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Video and animated stickers can't be sent via an HTTP URL."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -47,9 +45,7 @@ class SendSticker(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -71,8 +67,8 @@ class SendSticker(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
sticker: Union[InputFile, str],
chat_id: ChatIdUnion,
sticker: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
@ -81,9 +77,7 @@ class SendSticker(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -5,14 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
@ -26,7 +19,7 @@ class SendVenue(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendVenue"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
latitude: float
"""Latitude of the venue"""
@ -58,9 +51,7 @@ class SendVenue(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -82,7 +73,7 @@ class SendVenue(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
latitude: float,
longitude: float,
title: str,
@ -98,9 +89,7 @@ class SendVenue(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,19 +1,18 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
DateTimeUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -29,9 +28,9 @@ class SendVideo(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendVideo"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video: Union[InputFile, str]
video: InputFileUnion
"""Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -45,9 +44,9 @@ class SendVideo(TelegramMethod[Message]):
"""Video height"""
thumbnail: Optional[InputFile] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
cover: Optional[Union[InputFile, str]] = None
cover: Optional[InputFileUnion] = None
"""Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
start_timestamp: Optional[DateTimeUnion] = None
"""Start timestamp for the video in the message"""
caption: Optional[str] = None
"""Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing"""
@ -71,9 +70,7 @@ class SendVideo(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -95,16 +92,16 @@ class SendVideo(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
video: Union[InputFile, str],
chat_id: ChatIdUnion,
video: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
cover: Optional[Union[InputFile, str]] = None,
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
cover: Optional[InputFileUnion] = None,
start_timestamp: Optional[DateTimeUnion] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
@ -118,9 +115,7 @@ class SendVideo(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -6,12 +6,11 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -27,9 +26,9 @@ class SendVideoNote(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendVideoNote"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video_note: Union[InputFile, str]
video_note: InputFileUnion
"""Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Sending video notes by a URL is currently unsupported"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -51,9 +50,7 @@ class SendVideoNote(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -75,8 +72,8 @@ class SendVideoNote(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
video_note: Union[InputFile, str],
chat_id: ChatIdUnion,
video_note: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
@ -87,9 +84,7 @@ class SendVideoNote(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -6,13 +6,11 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputFile,
ChatIdUnion,
InputFileUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
@ -28,9 +26,9 @@ class SendVoice(TelegramMethod[Message]):
__returning__ = Message
__api_method__ = "sendVoice"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
voice: Union[InputFile, str]
voice: InputFileUnion
"""Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
@ -54,9 +52,7 @@ class SendVoice(TelegramMethod[Message]):
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
@ -78,8 +74,8 @@ class SendVoice(TelegramMethod[Message]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
voice: Union[InputFile, str],
chat_id: ChatIdUnion,
voice: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
@ -91,9 +87,7 @@ class SendVoice(TelegramMethod[Message]):
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class SetChatAdministratorCustomTitle(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatAdministratorCustomTitle"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -29,7 +30,7 @@ class SetChatAdministratorCustomTitle(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
custom_title: str,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class SetChatDescription(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatDescription"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
description: Optional[str] = None
"""New chat description, 0-255 characters"""
@ -27,7 +28,7 @@ class SetChatDescription(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
description: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from ..types import MenuButtonUnion
from .base import TelegramMethod
@ -18,7 +18,7 @@ class SetChatMenuButton(TelegramMethod[bool]):
chat_id: Optional[int] = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"""
menu_button: Optional[Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]] = None
menu_button: Optional[MenuButtonUnion] = None
"""A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`"""
if TYPE_CHECKING:
@ -29,9 +29,7 @@ class SetChatMenuButton(TelegramMethod[bool]):
__pydantic__self__,
*,
chat_id: Optional[int] = None,
menu_button: Optional[
Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
] = None,
menu_button: Optional[MenuButtonUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatPermissions
from ..types import ChatIdUnion, ChatPermissions
from .base import TelegramMethod
@ -16,7 +16,7 @@ class SetChatPermissions(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatPermissions"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
permissions: ChatPermissions
"""A JSON-serialized object for new default chat permissions"""
@ -30,7 +30,7 @@ class SetChatPermissions(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
permissions: ChatPermissions,
use_independent_chat_permissions: Optional[bool] = None,
**__pydantic_kwargs: Any,

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import InputFile
from ..types import ChatIdUnion, InputFile
from .base import TelegramMethod
@ -16,7 +16,7 @@ class SetChatPhoto(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatPhoto"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
photo: InputFile
"""New chat photo, uploaded using multipart/form-data"""
@ -26,11 +26,7 @@ class SetChatPhoto(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
photo: InputFile,
**__pydantic_kwargs: Any,
__pydantic__self__, *, chat_id: ChatIdUnion, photo: InputFile, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class SetChatStickerSet(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatStickerSet"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
sticker_set_name: str
"""Name of the sticker set to be set as the group sticker set"""
@ -27,7 +28,7 @@ class SetChatStickerSet(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
sticker_set_name: str,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class SetChatTitle(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setChatTitle"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
title: str
"""New chat title, 1-128 characters"""
@ -25,7 +26,7 @@ class SetChatTitle(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], title: str, **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, title: str, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji, ReactionTypePaid
from ..types import ChatIdUnion, ReactionTypeUnion
from .base import TelegramMethod
@ -14,13 +14,11 @@ class SetMessageReaction(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "setMessageReaction"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."""
reaction: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None
reaction: Optional[list[ReactionTypeUnion]] = None
"""A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."""
is_big: Optional[bool] = None
"""Pass :code:`True` to set the reaction with a big animation"""
@ -32,11 +30,9 @@ class SetMessageReaction(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_id: int,
reaction: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
reaction: Optional[list[ReactionTypeUnion]] = None,
is_big: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,17 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from ..types import BotCommand, BotCommandScopeUnion
from .base import TelegramMethod
@ -27,17 +18,7 @@ class SetMyCommands(TelegramMethod[bool]):
commands: list[BotCommand]
"""A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."""
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
scope: Optional[BotCommandScopeUnion] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
@ -50,17 +31,7 @@ class SetMyCommands(TelegramMethod[bool]):
__pydantic__self__,
*,
commands: list[BotCommand],
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,18 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import (
PassportElementErrorDataField,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
)
from ..types import PassportElementErrorUnion
from .base import TelegramMethod
@ -29,19 +19,7 @@ class SetPassportDataErrors(TelegramMethod[bool]):
user_id: int
"""User identifier"""
errors: list[
Union[
PassportElementErrorDataField,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
]
]
errors: list[PassportElementErrorUnion]
"""A JSON-serialized array describing the errors"""
if TYPE_CHECKING:
@ -52,19 +30,7 @@ class SetPassportDataErrors(TelegramMethod[bool]):
__pydantic__self__,
*,
user_id: int,
errors: list[
Union[
PassportElementErrorDataField,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
]
],
errors: list[PassportElementErrorUnion],
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import InputFile
from ..types import InputFileUnion
from .base import TelegramMethod
@ -22,7 +22,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
"""User identifier of the sticker set owner"""
format: str
"""Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video"""
thumbnail: Optional[Union[InputFile, str]] = None
thumbnail: Optional[InputFileUnion] = None
"""A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."""
if TYPE_CHECKING:
@ -35,7 +35,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
name: str,
user_id: int,
format: str,
thumbnail: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[InputFileUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,8 +1,8 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import DateTimeUnion
from .base import TelegramMethod
@ -20,9 +20,7 @@ class SetUserEmojiStatus(TelegramMethod[bool]):
"""Unique identifier of the target user"""
emoji_status_custom_emoji_id: Optional[str] = None
"""Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status."""
emoji_status_expiration_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = (
None
)
emoji_status_expiration_date: Optional[DateTimeUnion] = None
"""Expiration date of the emoji status, if any"""
if TYPE_CHECKING:
@ -34,9 +32,7 @@ class SetUserEmojiStatus(TelegramMethod[bool]):
*,
user_id: int,
emoji_status_custom_emoji_id: Optional[str] = None,
emoji_status_expiration_date: Optional[
Union[datetime.datetime, datetime.timedelta, int]
] = None,
emoji_status_expiration_date: Optional[DateTimeUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod
@ -18,7 +18,7 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message with live location to stop"""
@ -35,7 +35,7 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
__pydantic__self__,
*,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,

View file

@ -1,8 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import InlineKeyboardMarkup, Poll
from ..types import ChatIdUnion, InlineKeyboardMarkup, Poll
from .base import TelegramMethod
@ -16,7 +16,7 @@ class StopPoll(TelegramMethod[Poll]):
__returning__ = Poll
__api_method__ = "stopPoll"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the original message with the poll"""
@ -32,7 +32,7 @@ class StopPoll(TelegramMethod[Poll]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_id: int,
business_connection_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnbanChatMember(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unbanChatMember"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -29,7 +30,7 @@ class UnbanChatMember(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
only_if_banned: Optional[bool] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnbanChatSenderChat(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unbanChatSenderChat"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
@ -27,7 +28,7 @@ class UnbanChatSenderChat(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
sender_chat_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnhideGeneralForumTopic(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unhideGeneralForumTopic"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class UnhideGeneralForumTopic(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnpinAllChatMessages(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unpinAllChatMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
@ -23,7 +24,7 @@ class UnpinAllChatMessages(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnpinAllForumTopicMessages(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unpinAllForumTopicMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
@ -27,7 +28,7 @@ class UnpinAllForumTopicMessages(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
message_thread_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,7 +1,9 @@
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from aiogram.methods import TelegramMethod
from ..types import ChatIdUnion
class UnpinAllGeneralForumTopicMessages(TelegramMethod[bool]):
"""
@ -13,7 +15,7 @@ class UnpinAllGeneralForumTopicMessages(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unpinAllGeneralForumTopicMessages"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -21,7 +23,7 @@ class UnpinAllGeneralForumTopicMessages(TelegramMethod[bool]):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class UnpinChatMessage(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "unpinChatMessage"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be unpinned"""
@ -29,7 +30,7 @@ class UnpinChatMessage(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
business_connection_id: Optional[str] = None,
message_id: Optional[int] = None,
**__pydantic_kwargs: Any,

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
@ -15,7 +16,7 @@ class VerifyChat(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "verifyChat"
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
custom_description: Optional[str] = None
"""Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."""
@ -27,7 +28,7 @@ class VerifyChat(TelegramMethod[bool]):
def __init__(
__pydantic__self__,
*,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
custom_description: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -7,10 +7,12 @@ from .background_fill import BackgroundFill
from .background_fill_freeform_gradient import BackgroundFillFreeformGradient
from .background_fill_gradient import BackgroundFillGradient
from .background_fill_solid import BackgroundFillSolid
from .background_fill_union import BackgroundFillUnion
from .background_type import BackgroundType
from .background_type_chat_theme import BackgroundTypeChatTheme
from .background_type_fill import BackgroundTypeFill
from .background_type_pattern import BackgroundTypePattern
from .background_type_union import BackgroundTypeUnion
from .background_type_wallpaper import BackgroundTypeWallpaper
from .base import UNSET_PARSE_MODE, TelegramObject
from .birthdate import Birthdate
@ -25,6 +27,7 @@ from .bot_command_scope_chat import BotCommandScopeChat
from .bot_command_scope_chat_administrators import BotCommandScopeChatAdministrators
from .bot_command_scope_chat_member import BotCommandScopeChatMember
from .bot_command_scope_default import BotCommandScopeDefault
from .bot_command_scope_union import BotCommandScopeUnion
from .bot_description import BotDescription
from .bot_name import BotName
from .bot_short_description import BotShortDescription
@ -46,8 +49,10 @@ from .chat_boost_source import ChatBoostSource
from .chat_boost_source_gift_code import ChatBoostSourceGiftCode
from .chat_boost_source_giveaway import ChatBoostSourceGiveaway
from .chat_boost_source_premium import ChatBoostSourcePremium
from .chat_boost_source_union import ChatBoostSourceUnion
from .chat_boost_updated import ChatBoostUpdated
from .chat_full_info import ChatFullInfo
from .chat_id_union import ChatIdUnion
from .chat_invite_link import ChatInviteLink
from .chat_join_request import ChatJoinRequest
from .chat_location import ChatLocation
@ -58,6 +63,7 @@ from .chat_member_left import ChatMemberLeft
from .chat_member_member import ChatMemberMember
from .chat_member_owner import ChatMemberOwner
from .chat_member_restricted import ChatMemberRestricted
from .chat_member_union import ChatMemberUnion
from .chat_member_updated import ChatMemberUpdated
from .chat_permissions import ChatPermissions
from .chat_photo import ChatPhoto
@ -66,6 +72,7 @@ from .chosen_inline_result import ChosenInlineResult
from .contact import Contact
from .copy_text_button import CopyTextButton
from .custom import DateTime
from .date_time_union import DateTimeUnion
from .dice import Dice
from .document import Document
from .downloadable import Downloadable
@ -112,12 +119,14 @@ from .inline_query_result_gif import InlineQueryResultGif
from .inline_query_result_location import InlineQueryResultLocation
from .inline_query_result_mpeg4_gif import InlineQueryResultMpeg4Gif
from .inline_query_result_photo import InlineQueryResultPhoto
from .inline_query_result_union import InlineQueryResultUnion
from .inline_query_result_venue import InlineQueryResultVenue
from .inline_query_result_video import InlineQueryResultVideo
from .inline_query_result_voice import InlineQueryResultVoice
from .inline_query_results_button import InlineQueryResultsButton
from .input_contact_message_content import InputContactMessageContent
from .input_file import BufferedInputFile, FSInputFile, InputFile, URLInputFile
from .input_file_union import InputFileUnion
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_media import InputMedia
@ -125,12 +134,16 @@ from .input_media_animation import InputMediaAnimation
from .input_media_audio import InputMediaAudio
from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto
from .input_media_union import InputMediaUnion
from .input_media_video import InputMediaVideo
from .input_message_content import InputMessageContent
from .input_message_content_union import InputMessageContentUnion
from .input_paid_media import InputPaidMedia
from .input_paid_media_photo import InputPaidMediaPhoto
from .input_paid_media_union import InputPaidMediaUnion
from .input_paid_media_video import InputPaidMediaVideo
from .input_poll_option import InputPollOption
from .input_poll_option_union import InputPollOptionUnion
from .input_sticker import InputSticker
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
@ -146,9 +159,12 @@ from .location import Location
from .login_url import LoginUrl
from .mask_position import MaskPosition
from .maybe_inaccessible_message import MaybeInaccessibleMessage
from .maybe_inaccessible_message_union import MaybeInaccessibleMessageUnion
from .media_union import MediaUnion
from .menu_button import MenuButton
from .menu_button_commands import MenuButtonCommands
from .menu_button_default import MenuButtonDefault
from .menu_button_union import MenuButtonUnion
from .menu_button_web_app import MenuButtonWebApp
from .message import ContentType, Message
from .message_auto_delete_timer_changed import MessageAutoDeleteTimerChanged
@ -158,6 +174,7 @@ from .message_origin import MessageOrigin
from .message_origin_channel import MessageOriginChannel
from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_union import MessageOriginUnion
from .message_origin_user import MessageOriginUser
from .message_reaction_count_updated import MessageReactionCountUpdated
from .message_reaction_updated import MessageReactionUpdated
@ -167,6 +184,7 @@ from .paid_media_info import PaidMediaInfo
from .paid_media_photo import PaidMediaPhoto
from .paid_media_preview import PaidMediaPreview
from .paid_media_purchased import PaidMediaPurchased
from .paid_media_union import PaidMediaUnion
from .paid_media_video import PaidMediaVideo
from .passport_data import PassportData
from .passport_element_error import PassportElementError
@ -180,6 +198,7 @@ from .passport_element_error_translation_file import PassportElementErrorTransla
from .passport_element_error_translation_files import (
PassportElementErrorTranslationFiles,
)
from .passport_element_error_union import PassportElementErrorUnion
from .passport_element_error_unspecified import PassportElementErrorUnspecified
from .passport_file import PassportFile
from .photo_size import PhotoSize
@ -194,15 +213,20 @@ from .reaction_type import ReactionType
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
from .reaction_type_union import ReactionTypeUnion
from .refunded_payment import RefundedPayment
from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove
from .reply_markup_union import ReplyMarkupUnion
from .reply_parameters import ReplyParameters
from .response_parameters import ResponseParameters
from .result_chat_member_union import ResultChatMemberUnion
from .result_menu_button_union import ResultMenuButtonUnion
from .revenue_withdrawal_state import RevenueWithdrawalState
from .revenue_withdrawal_state_failed import RevenueWithdrawalStateFailed
from .revenue_withdrawal_state_pending import RevenueWithdrawalStatePending
from .revenue_withdrawal_state_succeeded import RevenueWithdrawalStateSucceeded
from .revenue_withdrawal_state_union import RevenueWithdrawalStateUnion
from .sent_web_app_message import SentWebAppMessage
from .shared_user import SharedUser
from .shipping_address import ShippingAddress
@ -223,6 +247,7 @@ from .transaction_partner_fragment import TransactionPartnerFragment
from .transaction_partner_other import TransactionPartnerOther
from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
from .transaction_partner_telegram_api import TransactionPartnerTelegramApi
from .transaction_partner_union import TransactionPartnerUnion
from .transaction_partner_user import TransactionPartnerUser
from .update import Update
from .user import User
@ -251,10 +276,12 @@ __all__ = (
"BackgroundFillFreeformGradient",
"BackgroundFillGradient",
"BackgroundFillSolid",
"BackgroundFillUnion",
"BackgroundType",
"BackgroundTypeChatTheme",
"BackgroundTypeFill",
"BackgroundTypePattern",
"BackgroundTypeUnion",
"BackgroundTypeWallpaper",
"Birthdate",
"BotCommand",
@ -266,6 +293,7 @@ __all__ = (
"BotCommandScopeChatAdministrators",
"BotCommandScopeChatMember",
"BotCommandScopeDefault",
"BotCommandScopeUnion",
"BotDescription",
"BotName",
"BotShortDescription",
@ -288,8 +316,10 @@ __all__ = (
"ChatBoostSourceGiftCode",
"ChatBoostSourceGiveaway",
"ChatBoostSourcePremium",
"ChatBoostSourceUnion",
"ChatBoostUpdated",
"ChatFullInfo",
"ChatIdUnion",
"ChatInviteLink",
"ChatJoinRequest",
"ChatLocation",
@ -300,6 +330,7 @@ __all__ = (
"ChatMemberMember",
"ChatMemberOwner",
"ChatMemberRestricted",
"ChatMemberUnion",
"ChatMemberUpdated",
"ChatPermissions",
"ChatPhoto",
@ -309,6 +340,7 @@ __all__ = (
"ContentType",
"CopyTextButton",
"DateTime",
"DateTimeUnion",
"Dice",
"Document",
"Downloadable",
@ -356,12 +388,14 @@ __all__ = (
"InlineQueryResultLocation",
"InlineQueryResultMpeg4Gif",
"InlineQueryResultPhoto",
"InlineQueryResultUnion",
"InlineQueryResultVenue",
"InlineQueryResultVideo",
"InlineQueryResultVoice",
"InlineQueryResultsButton",
"InputContactMessageContent",
"InputFile",
"InputFileUnion",
"InputInvoiceMessageContent",
"InputLocationMessageContent",
"InputMedia",
@ -369,12 +403,16 @@ __all__ = (
"InputMediaAudio",
"InputMediaDocument",
"InputMediaPhoto",
"InputMediaUnion",
"InputMediaVideo",
"InputMessageContent",
"InputMessageContentUnion",
"InputPaidMedia",
"InputPaidMediaPhoto",
"InputPaidMediaUnion",
"InputPaidMediaVideo",
"InputPollOption",
"InputPollOptionUnion",
"InputSticker",
"InputTextMessageContent",
"InputVenueMessageContent",
@ -390,9 +428,12 @@ __all__ = (
"LoginUrl",
"MaskPosition",
"MaybeInaccessibleMessage",
"MaybeInaccessibleMessageUnion",
"MediaUnion",
"MenuButton",
"MenuButtonCommands",
"MenuButtonDefault",
"MenuButtonUnion",
"MenuButtonWebApp",
"Message",
"MessageAutoDeleteTimerChanged",
@ -402,6 +443,7 @@ __all__ = (
"MessageOriginChannel",
"MessageOriginChat",
"MessageOriginHiddenUser",
"MessageOriginUnion",
"MessageOriginUser",
"MessageReactionCountUpdated",
"MessageReactionUpdated",
@ -411,6 +453,7 @@ __all__ = (
"PaidMediaPhoto",
"PaidMediaPreview",
"PaidMediaPurchased",
"PaidMediaUnion",
"PaidMediaVideo",
"PassportData",
"PassportElementError",
@ -422,6 +465,7 @@ __all__ = (
"PassportElementErrorSelfie",
"PassportElementErrorTranslationFile",
"PassportElementErrorTranslationFiles",
"PassportElementErrorUnion",
"PassportElementErrorUnspecified",
"PassportFile",
"PhotoSize",
@ -436,15 +480,20 @@ __all__ = (
"ReactionTypeCustomEmoji",
"ReactionTypeEmoji",
"ReactionTypePaid",
"ReactionTypeUnion",
"RefundedPayment",
"ReplyKeyboardMarkup",
"ReplyKeyboardRemove",
"ReplyMarkupUnion",
"ReplyParameters",
"ResponseParameters",
"ResultChatMemberUnion",
"ResultMenuButtonUnion",
"RevenueWithdrawalState",
"RevenueWithdrawalStateFailed",
"RevenueWithdrawalStatePending",
"RevenueWithdrawalStateSucceeded",
"RevenueWithdrawalStateUnion",
"SentWebAppMessage",
"SharedUser",
"ShippingAddress",
@ -466,6 +515,7 @@ __all__ = (
"TransactionPartnerOther",
"TransactionPartnerTelegramAds",
"TransactionPartnerTelegramApi",
"TransactionPartnerUnion",
"TransactionPartnerUser",
"UNSET_PARSE_MODE",
"URLInputFile",

View file

@ -0,0 +1,11 @@
from __future__ import annotations
from typing import Union
from .background_fill_freeform_gradient import BackgroundFillFreeformGradient
from .background_fill_gradient import BackgroundFillGradient
from .background_fill_solid import BackgroundFillSolid
BackgroundFillUnion = Union[
BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient
]

View file

@ -1,13 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Union
from typing import TYPE_CHECKING, Any, Literal
from .background_type import BackgroundType
if TYPE_CHECKING:
from .background_fill_freeform_gradient import BackgroundFillFreeformGradient
from .background_fill_gradient import BackgroundFillGradient
from .background_fill_solid import BackgroundFillSolid
from .background_fill_union import BackgroundFillUnion
class BackgroundTypeFill(BackgroundType):
@ -19,7 +17,7 @@ class BackgroundTypeFill(BackgroundType):
type: Literal["fill"] = "fill"
"""Type of the background, always 'fill'"""
fill: Union[BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient]
fill: BackgroundFillUnion
"""The background fill"""
dark_theme_dimming: int
"""Dimming of the background in dark themes, as a percentage; 0-100"""
@ -32,9 +30,7 @@ class BackgroundTypeFill(BackgroundType):
__pydantic__self__,
*,
type: Literal["fill"] = "fill",
fill: Union[
BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient
],
fill: BackgroundFillUnion,
dark_theme_dimming: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -1,13 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from .background_type import BackgroundType
if TYPE_CHECKING:
from .background_fill_freeform_gradient import BackgroundFillFreeformGradient
from .background_fill_gradient import BackgroundFillGradient
from .background_fill_solid import BackgroundFillSolid
from .background_fill_union import BackgroundFillUnion
from .document import Document
@ -22,7 +20,7 @@ class BackgroundTypePattern(BackgroundType):
"""Type of the background, always 'pattern'"""
document: Document
"""Document with the pattern"""
fill: Union[BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient]
fill: BackgroundFillUnion
"""The background fill that is combined with the pattern"""
intensity: int
"""Intensity of the pattern when it is shown above the filled background; 0-100"""
@ -40,9 +38,7 @@ class BackgroundTypePattern(BackgroundType):
*,
type: Literal["pattern"] = "pattern",
document: Document,
fill: Union[
BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient
],
fill: BackgroundFillUnion,
intensity: int,
is_inverted: Optional[bool] = None,
is_moving: Optional[bool] = None,

View file

@ -0,0 +1,12 @@
from __future__ import annotations
from typing import Union
from .background_type_chat_theme import BackgroundTypeChatTheme
from .background_type_fill import BackgroundTypeFill
from .background_type_pattern import BackgroundTypePattern
from .background_type_wallpaper import BackgroundTypeWallpaper
BackgroundTypeUnion = Union[
BackgroundTypeFill, BackgroundTypeWallpaper, BackgroundTypePattern, BackgroundTypeChatTheme
]

View file

@ -1,10 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Union
from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
if TYPE_CHECKING:
from .chat_id_union import ChatIdUnion
class BotCommandScopeChat(BotCommandScope):
"""
@ -15,7 +18,7 @@ class BotCommandScopeChat(BotCommandScope):
type: Literal[BotCommandScopeType.CHAT] = BotCommandScopeType.CHAT
"""Scope type, must be *chat*"""
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -26,7 +29,7 @@ class BotCommandScopeChat(BotCommandScope):
__pydantic__self__,
*,
type: Literal[BotCommandScopeType.CHAT] = BotCommandScopeType.CHAT,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,10 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Union
from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
if TYPE_CHECKING:
from .chat_id_union import ChatIdUnion
class BotCommandScopeChatAdministrators(BotCommandScope):
"""
@ -17,7 +20,7 @@ class BotCommandScopeChatAdministrators(BotCommandScope):
BotCommandScopeType.CHAT_ADMINISTRATORS
)
"""Scope type, must be *chat_administrators*"""
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
@ -30,7 +33,7 @@ class BotCommandScopeChatAdministrators(BotCommandScope):
type: Literal[
BotCommandScopeType.CHAT_ADMINISTRATORS
] = BotCommandScopeType.CHAT_ADMINISTRATORS,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,10 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Union
from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
if TYPE_CHECKING:
from .chat_id_union import ChatIdUnion
class BotCommandScopeChatMember(BotCommandScope):
"""
@ -15,7 +18,7 @@ class BotCommandScopeChatMember(BotCommandScope):
type: Literal[BotCommandScopeType.CHAT_MEMBER] = BotCommandScopeType.CHAT_MEMBER
"""Scope type, must be *chat_member*"""
chat_id: Union[int, str]
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
user_id: int
"""Unique identifier of the target user"""
@ -28,7 +31,7 @@ class BotCommandScopeChatMember(BotCommandScope):
__pydantic__self__,
*,
type: Literal[BotCommandScopeType.CHAT_MEMBER] = BotCommandScopeType.CHAT_MEMBER,
chat_id: Union[int, str],
chat_id: ChatIdUnion,
user_id: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -0,0 +1,23 @@
from __future__ import annotations
from typing import Union
from .bot_command_scope_all_chat_administrators import (
BotCommandScopeAllChatAdministrators,
)
from .bot_command_scope_all_group_chats import BotCommandScopeAllGroupChats
from .bot_command_scope_all_private_chats import BotCommandScopeAllPrivateChats
from .bot_command_scope_chat import BotCommandScopeChat
from .bot_command_scope_chat_administrators import BotCommandScopeChatAdministrators
from .bot_command_scope_chat_member import BotCommandScopeChatMember
from .bot_command_scope_default import BotCommandScopeDefault
BotCommandScopeUnion = Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]

Some files were not shown because too many files have changed in this diff Show more