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.
This commit is contained in:
JRoot Junior 2025-03-06 23:24:03 +02:00
parent 843c1dec7c
commit 703407b7aa
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
73 changed files with 560 additions and 1298 deletions

View file

@ -161,13 +161,7 @@ from ..methods import (
)
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
BotCommandScopeUnion,
BotDescription,
BotName,
BotShortDescription,
@ -189,35 +183,15 @@ from ..types import (
GameHighScore,
Gifts,
InlineKeyboardMarkup,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultContact,
InlineQueryResultDocument,
InlineQueryResultGame,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultsButton,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
InlineQueryResultUnion,
InputFile,
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaUnion,
InputMediaVideo,
InputPaidMediaPhoto,
InputPaidMediaVideo,
InputPaidMediaUnion,
InputPollOption,
InputSticker,
LabeledPrice,
@ -225,24 +199,15 @@ from ..types import (
MaskPosition,
MenuButtonCommands,
MenuButtonDefault,
MenuButtonUnion,
MenuButtonWebApp,
Message,
MessageEntity,
MessageId,
PassportElementErrorDataField,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
PassportElementErrorUnion,
Poll,
PreparedInlineMessage,
ReactionTypeCustomEmoji,
ReactionTypeEmoji,
ReactionTypePaid,
ReactionTypeUnion,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
@ -579,30 +544,7 @@ class Bot:
async def answer_inline_query(
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,
@ -700,28 +642,7 @@ class Bot:
async def answer_web_app_query(
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,
request_timeout: Optional[int] = None,
) -> SentWebAppMessage:
"""
@ -1235,17 +1156,7 @@ class Bot:
async def delete_my_commands(
self,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
@ -1468,13 +1379,7 @@ class Bot:
async def edit_message_media(
self,
media: Union[
InputMediaAnimation,
InputMediaDocument,
InputMediaAudio,
InputMediaPhoto,
InputMediaVideo,
],
media: InputMediaUnion,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None,
@ -1875,17 +1780,7 @@ class Bot:
async def get_my_commands(
self,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> list[BotCommand]:
@ -3547,9 +3442,7 @@ class Bot:
async def set_chat_menu_button(
self,
chat_id: Optional[int] = None,
menu_button: Optional[
Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
] = None,
menu_button: Optional[MenuButtonUnion] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
@ -3705,17 +3598,7 @@ class Bot:
async def set_my_commands(
self,
commands: list[BotCommand],
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
scope: Optional[BotCommandScopeUnion] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
@ -3764,19 +3647,7 @@ class Bot:
async def set_passport_data_errors(
self,
user_id: int,
errors: list[
Union[
PassportElementErrorDataField,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
]
],
errors: list[PassportElementErrorUnion],
request_timeout: Optional[int] = None,
) -> bool:
"""
@ -4612,9 +4483,7 @@ class Bot:
self,
chat_id: Union[int, str],
message_id: int,
reaction: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
reaction: Optional[list[ReactionTypeUnion]] = None,
is_big: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
@ -4738,7 +4607,7 @@ class Bot:
self,
chat_id: Union[int, str],
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,
@ -4895,28 +4764,7 @@ class Bot:
async def save_prepared_inline_message(
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

@ -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,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

@ -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 InlineKeyboardMarkup, InputMediaUnion, Message
from .base import TelegramMethod
@ -24,9 +16,7 @@ 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"""
@ -46,13 +36,7 @@ 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,
message_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,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

@ -5,8 +5,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputPaidMediaPhoto,
InputPaidMediaVideo,
InputPaidMediaUnion,
Message,
MessageEntity,
ReplyKeyboardMarkup,
@ -30,7 +29,7 @@ class SendPaidMedia(TelegramMethod[Message]):
"""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"""
@ -66,7 +65,7 @@ class SendPaidMedia(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
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,

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,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji, ReactionTypePaid
from ..types import ReactionTypeUnion
from .base import TelegramMethod
@ -18,9 +18,7 @@ class SetMessageReaction(TelegramMethod[bool]):
"""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"""
@ -34,9 +32,7 @@ class SetMessageReaction(TelegramMethod[bool]):
*,
chat_id: Union[int, str],
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

@ -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,11 @@ 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 .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 +173,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 +183,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 +197,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 +212,18 @@ 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 .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 +244,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 +273,12 @@ __all__ = (
"BackgroundFillFreeformGradient",
"BackgroundFillGradient",
"BackgroundFillSolid",
"BackgroundFillUnion",
"BackgroundType",
"BackgroundTypeChatTheme",
"BackgroundTypeFill",
"BackgroundTypePattern",
"BackgroundTypeUnion",
"BackgroundTypeWallpaper",
"Birthdate",
"BotCommand",
@ -266,6 +290,7 @@ __all__ = (
"BotCommandScopeChatAdministrators",
"BotCommandScopeChatMember",
"BotCommandScopeDefault",
"BotCommandScopeUnion",
"BotDescription",
"BotName",
"BotShortDescription",
@ -288,8 +313,10 @@ __all__ = (
"ChatBoostSourceGiftCode",
"ChatBoostSourceGiveaway",
"ChatBoostSourcePremium",
"ChatBoostSourceUnion",
"ChatBoostUpdated",
"ChatFullInfo",
"ChatIdUnion",
"ChatInviteLink",
"ChatJoinRequest",
"ChatLocation",
@ -300,6 +327,7 @@ __all__ = (
"ChatMemberMember",
"ChatMemberOwner",
"ChatMemberRestricted",
"ChatMemberUnion",
"ChatMemberUpdated",
"ChatPermissions",
"ChatPhoto",
@ -309,6 +337,7 @@ __all__ = (
"ContentType",
"CopyTextButton",
"DateTime",
"DateTimeUnion",
"Dice",
"Document",
"Downloadable",
@ -356,12 +385,14 @@ __all__ = (
"InlineQueryResultLocation",
"InlineQueryResultMpeg4Gif",
"InlineQueryResultPhoto",
"InlineQueryResultUnion",
"InlineQueryResultVenue",
"InlineQueryResultVideo",
"InlineQueryResultVoice",
"InlineQueryResultsButton",
"InputContactMessageContent",
"InputFile",
"InputFileUnion",
"InputInvoiceMessageContent",
"InputLocationMessageContent",
"InputMedia",
@ -369,12 +400,16 @@ __all__ = (
"InputMediaAudio",
"InputMediaDocument",
"InputMediaPhoto",
"InputMediaUnion",
"InputMediaVideo",
"InputMessageContent",
"InputMessageContentUnion",
"InputPaidMedia",
"InputPaidMediaPhoto",
"InputPaidMediaUnion",
"InputPaidMediaVideo",
"InputPollOption",
"InputPollOptionUnion",
"InputSticker",
"InputTextMessageContent",
"InputVenueMessageContent",
@ -390,9 +425,11 @@ __all__ = (
"LoginUrl",
"MaskPosition",
"MaybeInaccessibleMessage",
"MaybeInaccessibleMessageUnion",
"MenuButton",
"MenuButtonCommands",
"MenuButtonDefault",
"MenuButtonUnion",
"MenuButtonWebApp",
"Message",
"MessageAutoDeleteTimerChanged",
@ -402,6 +439,7 @@ __all__ = (
"MessageOriginChannel",
"MessageOriginChat",
"MessageOriginHiddenUser",
"MessageOriginUnion",
"MessageOriginUser",
"MessageReactionCountUpdated",
"MessageReactionUpdated",
@ -411,6 +449,7 @@ __all__ = (
"PaidMediaPhoto",
"PaidMediaPreview",
"PaidMediaPurchased",
"PaidMediaUnion",
"PaidMediaVideo",
"PassportData",
"PassportElementError",
@ -422,6 +461,7 @@ __all__ = (
"PassportElementErrorSelfie",
"PassportElementErrorTranslationFile",
"PassportElementErrorTranslationFiles",
"PassportElementErrorUnion",
"PassportElementErrorUnspecified",
"PassportFile",
"PhotoSize",
@ -436,15 +476,18 @@ __all__ = (
"ReactionTypeCustomEmoji",
"ReactionTypeEmoji",
"ReactionTypePaid",
"ReactionTypeUnion",
"RefundedPayment",
"ReplyKeyboardMarkup",
"ReplyKeyboardRemove",
"ReplyMarkupUnion",
"ReplyParameters",
"ResponseParameters",
"RevenueWithdrawalState",
"RevenueWithdrawalStateFailed",
"RevenueWithdrawalStatePending",
"RevenueWithdrawalStateSucceeded",
"RevenueWithdrawalStateUnion",
"SentWebAppMessage",
"SharedUser",
"ShippingAddress",
@ -466,6 +509,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

@ -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,
]

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
@ -8,8 +8,7 @@ from .base import TelegramObject
if TYPE_CHECKING:
from ..methods import AnswerCallbackQuery
from .inaccessible_message import InaccessibleMessage
from .message import Message
from .maybe_inaccessible_message_union import MaybeInaccessibleMessageUnion
from .user import User
@ -28,7 +27,7 @@ class CallbackQuery(TelegramObject):
"""Sender"""
chat_instance: str
"""Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in :class:`aiogram.methods.games.Games`."""
message: Optional[Union[Message, InaccessibleMessage]] = None
message: Optional[MaybeInaccessibleMessageUnion] = None
"""*Optional*. Message sent by the bot with the callback button that originated the query"""
inline_message_id: Optional[str] = None
"""*Optional*. Identifier of the message sent via the bot in inline mode, that originated the query."""
@ -47,7 +46,7 @@ class CallbackQuery(TelegramObject):
id: str,
from_user: User,
chat_instance: str,
message: Optional[Union[Message, InaccessibleMessage]] = None,
message: Optional[MaybeInaccessibleMessageUnion] = None,
inline_message_id: Optional[str] = None,
data: Optional[str] = None,
game_short_name: Optional[str] = None,

View file

@ -48,9 +48,7 @@ if TYPE_CHECKING:
from .chat_photo import ChatPhoto
from .input_file import InputFile
from .message import Message
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
class Chat(TelegramObject):
@ -84,9 +82,9 @@ class Chat(TelegramObject):
.. deprecated:: API:7.3
https://core.telegram.org/bots/api-changelog#may-6-2024"""
available_reactions: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = Field(None, json_schema_extra={"deprecated": True})
available_reactions: Optional[list[ReactionTypeUnion]] = Field(
None, json_schema_extra={"deprecated": True}
)
"""*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed. Returned only in :class:`aiogram.methods.get_chat.GetChat`.
.. deprecated:: API:7.3
@ -284,9 +282,7 @@ class Chat(TelegramObject):
is_forum: Optional[bool] = None,
accent_color_id: Optional[int] = None,
active_usernames: Optional[list[str]] = None,
available_reactions: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
available_reactions: Optional[list[ReactionTypeUnion]] = None,
background_custom_emoji_id: Optional[str] = None,
bio: Optional[str] = None,
birthdate: Optional[Birthdate] = None,

View file

@ -1,13 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
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
from .base import TelegramObject
from .background_type_union import BackgroundTypeUnion
class ChatBackground(TelegramObject):
@ -17,9 +15,7 @@ class ChatBackground(TelegramObject):
Source: https://core.telegram.org/bots/api#chatbackground
"""
type: Union[
BackgroundTypeFill, BackgroundTypeWallpaper, BackgroundTypePattern, BackgroundTypeChatTheme
]
type: BackgroundTypeUnion
"""Type of the background"""
if TYPE_CHECKING:
@ -27,15 +23,7 @@ class ChatBackground(TelegramObject):
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Union[
BackgroundTypeFill,
BackgroundTypeWallpaper,
BackgroundTypePattern,
BackgroundTypeChatTheme,
],
**__pydantic_kwargs: Any,
__pydantic__self__, *, type: BackgroundTypeUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`

View file

@ -1,14 +1,12 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
from .custom import DateTime
if TYPE_CHECKING:
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
class ChatBoost(TelegramObject):
@ -24,7 +22,7 @@ class ChatBoost(TelegramObject):
"""Point in time (Unix timestamp) when the chat was boosted"""
expiration_date: DateTime
"""Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged"""
source: Union[ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway]
source: ChatBoostSourceUnion
"""Source of the added boost"""
if TYPE_CHECKING:
@ -37,9 +35,7 @@ class ChatBoost(TelegramObject):
boost_id: str,
add_date: DateTime,
expiration_date: DateTime,
source: Union[
ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway
],
source: ChatBoostSourceUnion,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,15 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
from .custom import DateTime
if TYPE_CHECKING:
from .chat import Chat
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
class ChatBoostRemoved(TelegramObject):
@ -25,7 +23,7 @@ class ChatBoostRemoved(TelegramObject):
"""Unique identifier of the boost"""
remove_date: DateTime
"""Point in time (Unix timestamp) when the boost was removed"""
source: Union[ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway]
source: ChatBoostSourceUnion
"""Source of the removed boost"""
if TYPE_CHECKING:
@ -38,9 +36,7 @@ class ChatBoostRemoved(TelegramObject):
chat: Chat,
boost_id: str,
remove_date: DateTime,
source: Union[
ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway
],
source: ChatBoostSourceUnion,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,11 @@
from __future__ import annotations
from typing import Union
from .chat_boost_source_gift_code import ChatBoostSourceGiftCode
from .chat_boost_source_giveaway import ChatBoostSourceGiveaway
from .chat_boost_source_premium import ChatBoostSourcePremium
ChatBoostSourceUnion = Union[
ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway
]

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from .chat import Chat
from .custom import DateTime
@ -14,9 +14,7 @@ if TYPE_CHECKING:
from .chat_permissions import ChatPermissions
from .chat_photo import ChatPhoto
from .message import Message
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
class ChatFullInfo(Chat):
@ -58,9 +56,7 @@ class ChatFullInfo(Chat):
"""*Optional*. For private chats with business accounts, the opening hours of the business"""
personal_chat: Optional[Chat] = None
"""*Optional*. For private chats, the personal channel of the user"""
available_reactions: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None
available_reactions: Optional[list[ReactionTypeUnion]] = None
"""*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed."""
background_custom_emoji_id: Optional[str] = None
"""*Optional*. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background"""
@ -142,9 +138,7 @@ class ChatFullInfo(Chat):
business_location: Optional[BusinessLocation] = None,
business_opening_hours: Optional[BusinessOpeningHours] = None,
personal_chat: Optional[Chat] = None,
available_reactions: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
available_reactions: Optional[list[ReactionTypeUnion]] = None,
background_custom_emoji_id: Optional[str] = None,
profile_accent_color_id: Optional[int] = None,
profile_background_custom_emoji_id: Optional[str] = None,

View file

@ -0,0 +1,5 @@
from __future__ import annotations
from typing import Union
ChatIdUnion = Union[int, str]

View file

@ -0,0 +1,19 @@
from __future__ import annotations
from typing import Union
from .chat_member_administrator import ChatMemberAdministrator
from .chat_member_banned import ChatMemberBanned
from .chat_member_left import ChatMemberLeft
from .chat_member_member import ChatMemberMember
from .chat_member_owner import ChatMemberOwner
from .chat_member_restricted import ChatMemberRestricted
ChatMemberUnion = Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]

View file

@ -31,12 +31,7 @@ if TYPE_CHECKING:
)
from .chat import Chat
from .chat_invite_link import ChatInviteLink
from .chat_member_administrator import ChatMemberAdministrator
from .chat_member_banned import ChatMemberBanned
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 .force_reply import ForceReply
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_file import InputFile
@ -67,23 +62,9 @@ class ChatMemberUpdated(TelegramObject):
"""Performer of the action, which resulted in the change"""
date: DateTime
"""Date the change was done in Unix time"""
old_chat_member: Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
old_chat_member: ChatMemberUnion
"""Previous information about the chat member"""
new_chat_member: Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
]
new_chat_member: ChatMemberUnion
"""New information about the chat member"""
invite_link: Optional[ChatInviteLink] = None
"""*Optional*. Chat invite link, which was used by the user to join the chat; for joining by invite link events only."""
@ -102,22 +83,8 @@ class ChatMemberUpdated(TelegramObject):
chat: Chat,
from_user: User,
date: DateTime,
old_chat_member: Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
],
new_chat_member: Union[
ChatMemberOwner,
ChatMemberAdministrator,
ChatMemberMember,
ChatMemberRestricted,
ChatMemberLeft,
ChatMemberBanned,
],
old_chat_member: ChatMemberUnion,
new_chat_member: ChatMemberUnion,
invite_link: Optional[ChatInviteLink] = None,
via_join_request: Optional[bool] = None,
via_chat_folder_invite_link: Optional[bool] = None,

View file

@ -0,0 +1,6 @@
from __future__ import annotations
import datetime
from typing import Union
DateTimeUnion = Union[datetime.datetime, datetime.timedelta, int]

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
@ -17,10 +17,7 @@ if TYPE_CHECKING:
from .invoice import Invoice
from .link_preview_options import LinkPreviewOptions
from .location import Location
from .message_origin_channel import MessageOriginChannel
from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_user import MessageOriginUser
from .message_origin_union import MessageOriginUnion
from .paid_media_info import PaidMediaInfo
from .photo_size import PhotoSize
from .poll import Poll
@ -39,9 +36,7 @@ class ExternalReplyInfo(TelegramObject):
Source: https://core.telegram.org/bots/api#externalreplyinfo
"""
origin: Union[
MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, MessageOriginChannel
]
origin: MessageOriginUnion
"""Origin of the message replied to by the given message"""
chat: Optional[Chat] = None
"""*Optional*. Chat the original message belongs to. Available only if the chat is a supergroup or a channel."""
@ -97,9 +92,7 @@ class ExternalReplyInfo(TelegramObject):
def __init__(
__pydantic__self__,
*,
origin: Union[
MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, MessageOriginChannel
],
origin: MessageOriginUnion,
chat: Optional[Chat] = None,
message_id: Optional[int] = None,
link_preview_options: Optional[LinkPreviewOptions] = None,

View file

@ -37,8 +37,7 @@ if TYPE_CHECKING:
from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto
from .input_media_video import InputMediaVideo
from .input_paid_media_photo import InputPaidMediaPhoto
from .input_paid_media_video import InputPaidMediaVideo
from .input_paid_media_union import InputPaidMediaUnion
from .input_poll_option import InputPollOption
from .labeled_price import LabeledPrice
from .link_preview_options import LinkPreviewOptions
@ -2810,7 +2809,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
def answer_paid_media(
self,
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,
@ -2881,7 +2880,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
def reply_paid_media(
self,
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,

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
@ -8,26 +8,7 @@ from .base import TelegramObject
if TYPE_CHECKING:
from ..methods import AnswerInlineQuery
from .inline_query_result_article import InlineQueryResultArticle
from .inline_query_result_audio import InlineQueryResultAudio
from .inline_query_result_cached_audio import InlineQueryResultCachedAudio
from .inline_query_result_cached_document import InlineQueryResultCachedDocument
from .inline_query_result_cached_gif import InlineQueryResultCachedGif
from .inline_query_result_cached_mpeg4_gif import InlineQueryResultCachedMpeg4Gif
from .inline_query_result_cached_photo import InlineQueryResultCachedPhoto
from .inline_query_result_cached_sticker import InlineQueryResultCachedSticker
from .inline_query_result_cached_video import InlineQueryResultCachedVideo
from .inline_query_result_cached_voice import InlineQueryResultCachedVoice
from .inline_query_result_contact import InlineQueryResultContact
from .inline_query_result_document import InlineQueryResultDocument
from .inline_query_result_game import InlineQueryResultGame
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_venue import InlineQueryResultVenue
from .inline_query_result_video import InlineQueryResultVideo
from .inline_query_result_voice import InlineQueryResultVoice
from .inline_query_result_union import InlineQueryResultUnion
from .inline_query_results_button import InlineQueryResultsButton
from .location import Location
from .user import User
@ -84,30 +65,7 @@ class InlineQuery(TelegramObject):
def answer(
self,
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,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from pydantic import Field
@ -9,11 +9,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
class InlineQueryResultArticle(InlineQueryResult):
@ -29,13 +25,7 @@ class InlineQueryResultArticle(InlineQueryResult):
"""Unique identifier for this result, 1-64 Bytes"""
title: str
"""Title of the result"""
input_message_content: Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
input_message_content: InputMessageContentUnion
"""Content of the message to be sent"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
@ -65,13 +55,7 @@ class InlineQueryResultArticle(InlineQueryResult):
type: Literal[InlineQueryResultType.ARTICLE] = InlineQueryResultType.ARTICLE,
id: str,
title: str,
input_message_content: Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
],
input_message_content: InputMessageContentUnion,
reply_markup: Optional[InlineKeyboardMarkup] = None,
url: Optional[str] = None,
description: Optional[str] = None,

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -43,15 +39,7 @@ class InlineQueryResultAudio(InlineQueryResult):
"""*Optional*. Audio duration in seconds"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the audio"""
if TYPE_CHECKING:
@ -71,15 +59,7 @@ class InlineQueryResultAudio(InlineQueryResult):
performer: Optional[str] = None,
audio_duration: Optional[int] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -37,15 +33,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
"""*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the audio"""
if TYPE_CHECKING:
@ -62,15 +50,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -41,15 +37,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
"""*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the file"""
if TYPE_CHECKING:
@ -68,15 +56,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -41,15 +37,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the GIF animation"""
if TYPE_CHECKING:
@ -70,15 +58,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -41,15 +37,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the video animation"""
if TYPE_CHECKING:
@ -70,15 +58,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -43,15 +39,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the photo"""
if TYPE_CHECKING:
@ -73,15 +61,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,17 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
class InlineQueryResultCachedSticker(InlineQueryResult):
@ -29,15 +25,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
"""A valid file identifier of the sticker"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the sticker"""
if TYPE_CHECKING:
@ -51,15 +39,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
id: str,
sticker_file_id: str,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -43,15 +39,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the video"""
if TYPE_CHECKING:
@ -73,15 +61,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -39,15 +35,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
"""*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the voice message"""
if TYPE_CHECKING:
@ -65,15 +53,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,17 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
class InlineQueryResultContact(InlineQueryResult):
@ -35,15 +31,7 @@ class InlineQueryResultContact(InlineQueryResult):
"""*Optional*. Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the contact"""
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
@ -66,15 +54,7 @@ class InlineQueryResultContact(InlineQueryResult):
last_name: Optional[str] = None,
vcard: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
thumbnail_url: Optional[str] = None,
thumbnail_width: Optional[int] = None,
thumbnail_height: Optional[int] = None,

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -43,15 +39,7 @@ class InlineQueryResultDocument(InlineQueryResult):
"""*Optional*. Short description of the result"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. Inline keyboard attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the file"""
thumbnail_url: Optional[str] = None
"""*Optional*. URL of the thumbnail (JPEG only) for the file"""
@ -77,15 +65,7 @@ class InlineQueryResultDocument(InlineQueryResult):
caption_entities: Optional[list[MessageEntity]] = None,
description: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
thumbnail_url: Optional[str] = None,
thumbnail_width: Optional[int] = None,
thumbnail_height: Optional[int] = None,

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -51,15 +47,7 @@ class InlineQueryResultGif(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the GIF animation"""
if TYPE_CHECKING:
@ -85,15 +73,7 @@ class InlineQueryResultGif(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,17 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
class InlineQueryResultLocation(InlineQueryResult):
@ -41,15 +37,7 @@ class InlineQueryResultLocation(InlineQueryResult):
"""*Optional*. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the location"""
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
@ -75,15 +63,7 @@ class InlineQueryResultLocation(InlineQueryResult):
heading: Optional[int] = None,
proximity_alert_radius: Optional[int] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
thumbnail_url: Optional[str] = None,
thumbnail_width: Optional[int] = None,
thumbnail_height: Optional[int] = None,

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -51,15 +47,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the video animation"""
if TYPE_CHECKING:
@ -85,15 +73,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -49,15 +45,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
"""*Optional*. Pass :code:`True`, if the caption must be shown above the message media"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the photo"""
if TYPE_CHECKING:
@ -82,15 +70,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import Union
from .inline_query_result_article import InlineQueryResultArticle
from .inline_query_result_audio import InlineQueryResultAudio
from .inline_query_result_cached_audio import InlineQueryResultCachedAudio
from .inline_query_result_cached_document import InlineQueryResultCachedDocument
from .inline_query_result_cached_gif import InlineQueryResultCachedGif
from .inline_query_result_cached_mpeg4_gif import InlineQueryResultCachedMpeg4Gif
from .inline_query_result_cached_photo import InlineQueryResultCachedPhoto
from .inline_query_result_cached_sticker import InlineQueryResultCachedSticker
from .inline_query_result_cached_video import InlineQueryResultCachedVideo
from .inline_query_result_cached_voice import InlineQueryResultCachedVoice
from .inline_query_result_contact import InlineQueryResultContact
from .inline_query_result_document import InlineQueryResultDocument
from .inline_query_result_game import InlineQueryResultGame
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_venue import InlineQueryResultVenue
from .inline_query_result_video import InlineQueryResultVideo
from .inline_query_result_voice import InlineQueryResultVoice
InlineQueryResultUnion = Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]

View file

@ -1,17 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
class InlineQueryResultVenue(InlineQueryResult):
@ -43,15 +39,7 @@ class InlineQueryResultVenue(InlineQueryResult):
"""*Optional*. Google Places type of the venue. (See `supported types <https://developers.google.com/places/web-service/supported_types>`_.)"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the venue"""
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
@ -78,15 +66,7 @@ class InlineQueryResultVenue(InlineQueryResult):
google_place_id: Optional[str] = None,
google_place_type: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
thumbnail_url: Optional[str] = None,
thumbnail_width: Optional[int] = None,
thumbnail_height: Optional[int] = None,

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -55,15 +51,7 @@ class InlineQueryResultVideo(InlineQueryResult):
"""*Optional*. Short description of the result"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the video. This field is **required** if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video)."""
if TYPE_CHECKING:
@ -90,15 +78,7 @@ class InlineQueryResultVideo(InlineQueryResult):
video_duration: Optional[int] = None,
description: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,11 +8,7 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .input_message_content_union import InputMessageContentUnion
from .message_entity import MessageEntity
@ -41,15 +37,7 @@ class InlineQueryResultVoice(InlineQueryResult):
"""*Optional*. Recording duration in seconds"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
input_message_content: Optional[InputMessageContentUnion] = None
"""*Optional*. Content of the message to be sent instead of the voice recording"""
if TYPE_CHECKING:
@ -68,15 +56,7 @@ class InlineQueryResultVoice(InlineQueryResult):
caption_entities: Optional[list[MessageEntity]] = None,
voice_duration: Optional[int] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None,
input_message_content: Optional[InputMessageContentUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,7 @@
from __future__ import annotations
from typing import Union
from .input_file import InputFile
InputFileUnion = Union[str, InputFile]

View file

@ -0,0 +1,13 @@
from __future__ import annotations
from typing import Union
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_video import InputMediaVideo
InputMediaUnion = Union[
InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
]

View file

@ -0,0 +1,17 @@
from __future__ import annotations
from typing import Union
from .input_contact_message_content import InputContactMessageContent
from .input_invoice_message_content import InputInvoiceMessageContent
from .input_location_message_content import InputLocationMessageContent
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
InputMessageContentUnion = Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]

View file

@ -0,0 +1,8 @@
from __future__ import annotations
from typing import Union
from .input_paid_media_photo import InputPaidMediaPhoto
from .input_paid_media_video import InputPaidMediaVideo
InputPaidMediaUnion = Union[InputPaidMediaPhoto, InputPaidMediaVideo]

View file

@ -0,0 +1,7 @@
from __future__ import annotations
from typing import Union
from .input_poll_option import InputPollOption
InputPollOptionUnion = Union[InputPollOption, str]

View file

@ -0,0 +1,8 @@
from __future__ import annotations
from typing import Union
from .inaccessible_message import InaccessibleMessage
from .message import Message
MaybeInaccessibleMessageUnion = Union[Message, InaccessibleMessage]

View file

@ -0,0 +1,9 @@
from __future__ import annotations
from typing import Union
from .menu_button_commands import MenuButtonCommands
from .menu_button_default import MenuButtonDefault
from .menu_button_web_app import MenuButtonWebApp
MenuButtonUnion = Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]

View file

@ -72,35 +72,29 @@ if TYPE_CHECKING:
from .giveaway_completed import GiveawayCompleted
from .giveaway_created import GiveawayCreated
from .giveaway_winners import GiveawayWinners
from .inaccessible_message import InaccessibleMessage
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_file import InputFile
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_paid_media_photo import InputPaidMediaPhoto
from .input_paid_media_video import InputPaidMediaVideo
from .input_paid_media_union import InputPaidMediaUnion
from .input_poll_option import InputPollOption
from .invoice import Invoice
from .labeled_price import LabeledPrice
from .link_preview_options import LinkPreviewOptions
from .location import Location
from .maybe_inaccessible_message_union import MaybeInaccessibleMessageUnion
from .message_auto_delete_timer_changed import MessageAutoDeleteTimerChanged
from .message_entity import MessageEntity
from .message_origin_channel import MessageOriginChannel
from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_user import MessageOriginUser
from .message_origin_union import MessageOriginUnion
from .paid_media_info import PaidMediaInfo
from .passport_data import PassportData
from .photo_size import PhotoSize
from .poll import Poll
from .proximity_alert_triggered import ProximityAlertTriggered
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
@ -148,9 +142,7 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account."""
business_connection_id: Optional[str] = None
"""*Optional*. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier."""
forward_origin: Optional[
Union[MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, MessageOriginChannel]
] = None
forward_origin: Optional[MessageOriginUnion] = None
"""*Optional*. Information about the original message for forwarded messages"""
is_topic_message: Optional[bool] = None
"""*Optional*. :code:`True`, if the message is sent to a forum topic"""
@ -246,7 +238,7 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."""
migrate_from_chat_id: Optional[int] = None
"""*Optional*. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."""
pinned_message: Optional[Union[Message, InaccessibleMessage]] = None
pinned_message: Optional[MaybeInaccessibleMessageUnion] = None
"""*Optional*. Specified message was pinned. Note that the Message object in this field will not contain further *reply_to_message* fields even if it itself is a reply."""
invoice: Optional[Invoice] = None
"""*Optional*. Message is an invoice for a `payment <https://core.telegram.org/bots/api#payments>`_, information about the invoice. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
@ -354,14 +346,7 @@ class Message(MaybeInaccessibleMessage):
sender_boost_count: Optional[int] = None,
sender_business_bot: Optional[User] = None,
business_connection_id: Optional[str] = None,
forward_origin: Optional[
Union[
MessageOriginUser,
MessageOriginHiddenUser,
MessageOriginChat,
MessageOriginChannel,
]
] = None,
forward_origin: Optional[MessageOriginUnion] = None,
is_topic_message: Optional[bool] = None,
is_automatic_forward: Optional[bool] = None,
reply_to_message: Optional[Message] = None,
@ -409,7 +394,7 @@ class Message(MaybeInaccessibleMessage):
message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = None,
migrate_to_chat_id: Optional[int] = None,
migrate_from_chat_id: Optional[int] = None,
pinned_message: Optional[Union[Message, InaccessibleMessage]] = None,
pinned_message: Optional[MaybeInaccessibleMessageUnion] = None,
invoice: Optional[Invoice] = None,
successful_payment: Optional[SuccessfulPayment] = None,
refunded_payment: Optional[RefundedPayment] = None,
@ -3745,13 +3730,7 @@ class Message(MaybeInaccessibleMessage):
def edit_media(
self,
media: Union[
InputMediaAnimation,
InputMediaDocument,
InputMediaAudio,
InputMediaPhoto,
InputMediaVideo,
],
media: InputMediaUnion,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
**kwargs: Any,
@ -4177,9 +4156,7 @@ class Message(MaybeInaccessibleMessage):
def react(
self,
reaction: Optional[
list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
reaction: Optional[list[ReactionTypeUnion]] = None,
is_big: Optional[bool] = None,
**kwargs: Any,
) -> SetMessageReaction:
@ -4220,7 +4197,7 @@ class Message(MaybeInaccessibleMessage):
def answer_paid_media(
self,
star_count: int,
media: list[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
media: list[InputPaidMediaUnion],
payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
@ -4292,7 +4269,7 @@ class Message(MaybeInaccessibleMessage):
def reply_paid_media(
self,
star_count: int,
media: list[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
media: list[InputPaidMediaUnion],
payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,

View file

@ -0,0 +1,12 @@
from __future__ import annotations
from typing import Union
from .message_origin_channel import MessageOriginChannel
from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_user import MessageOriginUser
MessageOriginUnion = Union[
MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, MessageOriginChannel
]

View file

@ -1,15 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .chat import Chat
from .custom import DateTime
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 .user import User
@ -26,9 +24,9 @@ class MessageReactionUpdated(TelegramObject):
"""Unique identifier of the message inside the chat"""
date: DateTime
"""Date of the change in Unix time"""
old_reaction: list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
old_reaction: list[ReactionTypeUnion]
"""Previous list of reaction types that were set by the user"""
new_reaction: list[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
new_reaction: list[ReactionTypeUnion]
"""New list of reaction types that have been set by the user"""
user: Optional[User] = None
"""*Optional*. The user that changed the reaction, if the user isn't anonymous"""
@ -45,12 +43,8 @@ class MessageReactionUpdated(TelegramObject):
chat: Chat,
message_id: int,
date: DateTime,
old_reaction: list[
Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
],
new_reaction: list[
Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
],
old_reaction: list[ReactionTypeUnion],
new_reaction: list[ReactionTypeUnion],
user: Optional[User] = None,
actor_chat: Optional[Chat] = None,
**__pydantic_kwargs: Any,

View file

@ -1,13 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .paid_media_photo import PaidMediaPhoto
from .paid_media_preview import PaidMediaPreview
from .paid_media_video import PaidMediaVideo
from .paid_media_union import PaidMediaUnion
class PaidMediaInfo(TelegramObject):
@ -19,7 +17,7 @@ class PaidMediaInfo(TelegramObject):
star_count: int
"""The number of Telegram Stars that must be paid to buy access to the media"""
paid_media: list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
paid_media: list[PaidMediaUnion]
"""Information about the paid media"""
if TYPE_CHECKING:
@ -30,7 +28,7 @@ class PaidMediaInfo(TelegramObject):
__pydantic__self__,
*,
star_count: int,
paid_media: list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]],
paid_media: list[PaidMediaUnion],
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,9 @@
from __future__ import annotations
from typing import Union
from .paid_media_photo import PaidMediaPhoto
from .paid_media_preview import PaidMediaPreview
from .paid_media_video import PaidMediaVideo
PaidMediaUnion = Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]

View file

@ -0,0 +1,27 @@
from __future__ import annotations
from typing import Union
from .passport_element_error_data_field import PassportElementErrorDataField
from .passport_element_error_file import PassportElementErrorFile
from .passport_element_error_files import PassportElementErrorFiles
from .passport_element_error_front_side import PassportElementErrorFrontSide
from .passport_element_error_reverse_side import PassportElementErrorReverseSide
from .passport_element_error_selfie import PassportElementErrorSelfie
from .passport_element_error_translation_file import PassportElementErrorTranslationFile
from .passport_element_error_translation_files import (
PassportElementErrorTranslationFiles,
)
from .passport_element_error_unspecified import PassportElementErrorUnspecified
PassportElementErrorUnion = Union[
PassportElementErrorDataField,
PassportElementErrorFrontSide,
PassportElementErrorReverseSide,
PassportElementErrorSelfie,
PassportElementErrorFile,
PassportElementErrorFiles,
PassportElementErrorTranslationFile,
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
]

View file

@ -1,13 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
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
class ReactionCount(TelegramObject):
@ -17,7 +15,7 @@ class ReactionCount(TelegramObject):
Source: https://core.telegram.org/bots/api#reactioncount
"""
type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
type: ReactionTypeUnion
"""Type of the reaction"""
total_count: int
"""Number of times the reaction was added"""
@ -29,7 +27,7 @@ class ReactionCount(TelegramObject):
def __init__(
__pydantic__self__,
*,
type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid],
type: ReactionTypeUnion,
total_count: int,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -0,0 +1,9 @@
from __future__ import annotations
from typing import Union
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
ReactionTypeUnion = Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]

View file

@ -0,0 +1,12 @@
from __future__ import annotations
from typing import Union
from .force_reply import ForceReply
from .inline_keyboard_markup import InlineKeyboardMarkup
from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove
ReplyMarkupUnion = Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
]

View file

@ -0,0 +1,11 @@
from __future__ import annotations
from typing import Union
from .revenue_withdrawal_state_failed import RevenueWithdrawalStateFailed
from .revenue_withdrawal_state_pending import RevenueWithdrawalStatePending
from .revenue_withdrawal_state_succeeded import RevenueWithdrawalStateSucceeded
RevenueWithdrawalStateUnion = Union[
RevenueWithdrawalStatePending, RevenueWithdrawalStateSucceeded, RevenueWithdrawalStateFailed
]

View file

@ -1,20 +1,12 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
from .custom import DateTime
if TYPE_CHECKING:
from .transaction_partner_affiliate_program import (
TransactionPartnerAffiliateProgram,
)
from .transaction_partner_chat import TransactionPartnerChat
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_user import TransactionPartnerUser
from .transaction_partner_union import TransactionPartnerUnion
class StarTransaction(TelegramObject):
@ -32,29 +24,9 @@ class StarTransaction(TelegramObject):
"""Date the transaction was created in Unix time"""
nanostar_amount: Optional[int] = None
"""*Optional*. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999"""
source: Optional[
Union[
TransactionPartnerUser,
TransactionPartnerChat,
TransactionPartnerAffiliateProgram,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]
] = None
source: Optional[TransactionPartnerUnion] = None
"""*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions"""
receiver: Optional[
Union[
TransactionPartnerUser,
TransactionPartnerChat,
TransactionPartnerAffiliateProgram,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]
] = None
receiver: Optional[TransactionPartnerUnion] = None
"""*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions"""
if TYPE_CHECKING:
@ -68,28 +40,8 @@ class StarTransaction(TelegramObject):
amount: int,
date: DateTime,
nanostar_amount: Optional[int] = None,
source: Optional[
Union[
TransactionPartnerUser,
TransactionPartnerChat,
TransactionPartnerAffiliateProgram,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]
] = None,
receiver: Optional[
Union[
TransactionPartnerUser,
TransactionPartnerChat,
TransactionPartnerAffiliateProgram,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]
] = None,
source: Optional[TransactionPartnerUnion] = None,
receiver: Optional[TransactionPartnerUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -1,14 +1,12 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
if TYPE_CHECKING:
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
class TransactionPartnerFragment(TransactionPartner):
@ -20,13 +18,7 @@ class TransactionPartnerFragment(TransactionPartner):
type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT
"""Type of the transaction partner, always 'fragment'"""
withdrawal_state: Optional[
Union[
RevenueWithdrawalStatePending,
RevenueWithdrawalStateSucceeded,
RevenueWithdrawalStateFailed,
]
] = None
withdrawal_state: Optional[RevenueWithdrawalStateUnion] = None
"""*Optional*. State of the transaction if the transaction is outgoing"""
if TYPE_CHECKING:
@ -37,13 +29,7 @@ class TransactionPartnerFragment(TransactionPartner):
__pydantic__self__,
*,
type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT,
withdrawal_state: Optional[
Union[
RevenueWithdrawalStatePending,
RevenueWithdrawalStateSucceeded,
RevenueWithdrawalStateFailed,
]
] = None,
withdrawal_state: Optional[RevenueWithdrawalStateUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,21 @@
from __future__ import annotations
from typing import Union
from .transaction_partner_affiliate_program import TransactionPartnerAffiliateProgram
from .transaction_partner_chat import TransactionPartnerChat
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_user import TransactionPartnerUser
TransactionPartnerUnion = Union[
TransactionPartnerUser,
TransactionPartnerChat,
TransactionPartnerAffiliateProgram,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerTelegramApi,
TransactionPartnerOther,
]

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
@ -8,9 +8,7 @@ from .transaction_partner import TransactionPartner
if TYPE_CHECKING:
from .affiliate_info import AffiliateInfo
from .gift import Gift
from .paid_media_photo import PaidMediaPhoto
from .paid_media_preview import PaidMediaPreview
from .paid_media_video import PaidMediaVideo
from .paid_media_union import PaidMediaUnion
from .user import User
@ -31,7 +29,7 @@ class TransactionPartnerUser(TransactionPartner):
"""*Optional*. Bot-specified invoice payload"""
subscription_period: Optional[int] = None
"""*Optional*. The duration of the paid subscription"""
paid_media: Optional[list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]] = None
paid_media: Optional[list[PaidMediaUnion]] = None
"""*Optional*. Information about the paid media bought by the user"""
paid_media_payload: Optional[str] = None
"""*Optional*. Bot-specified paid media payload"""
@ -50,9 +48,7 @@ class TransactionPartnerUser(TransactionPartner):
affiliate: Optional[AffiliateInfo] = None,
invoice_payload: Optional[str] = None,
subscription_period: Optional[int] = None,
paid_media: Optional[
list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
] = None,
paid_media: Optional[list[PaidMediaUnion]] = None,
paid_media_payload: Optional[str] = None,
gift: Optional[Gift] = None,
**__pydantic_kwargs: Any,