Fixed subtypes and union types generation, new enums added (#1213)

* Fixed subtypes and union types generation, new enums added

* Added changes description
This commit is contained in:
Alex Root Junior 2023-07-11 23:39:54 +03:00 committed by GitHub
parent a7b92bb050
commit 31c11c31e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 680 additions and 359 deletions

View file

@ -0,0 +1,10 @@
name: EncryptedPassportElement
description: |
This object represents type of encrypted passport element.
Source: https://core.telegram.org/bots/api#encryptedpassportelement
parse:
entity: EncryptedPassportElement
category: types
attribute: type
regexp: "'([a-z_]+)'"

View file

@ -0,0 +1,18 @@
name: PassportElementErrorType
description: |
This object represents a passport element error type.
Source: https://core.telegram.org/bots/api#passportelementerror
multi_parse:
attribute: source
regexp: 'must be ([a-z_]+)'
entities:
- PassportElementErrorDataField
- PassportElementErrorFrontSide
- PassportElementErrorReverseSide
- PassportElementErrorSelfie
- PassportElementErrorFile
- PassportElementErrorFiles
- PassportElementErrorTranslationFile
- PassportElementErrorTranslationFiles
- PassportElementErrorUnspecified

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,2 +0,0 @@
bases:
- BotCommandScope

View file

@ -1,27 +0,0 @@
define:
- type: "String"
description: "The member's status in the chat"
html_description: "<td>The member's status in the chat</td>"
rst_description: "The member's status in the chat"
name: "status"
required: true
clone:
- ChatMemberOwner:
exclude:
- status
- ChatMemberAdministrator:
exclude:
- status
- ChatMemberMember:
exclude:
- status
- ChatMemberRestricted:
exclude:
- status
- ChatMemberLeft:
exclude:
- status
- ChatMemberBanned:
exclude:
- status

View file

@ -0,0 +1 @@
discriminator: "status"

View file

@ -1,2 +0,0 @@
bases:
- ChatMember

View file

@ -1,5 +1,3 @@
bases:
- ChatMember
annotations:
until_date:
parsed_type:

View file

@ -1,2 +0,0 @@
bases:
- ChatMember

View file

@ -1,2 +0,0 @@
bases:
- ChatMember

View file

@ -1,2 +0,0 @@
bases:
- ChatMember

View file

@ -1,5 +1,3 @@
bases:
- ChatMember
annotations:
until_date:
parsed_type:

View file

@ -3,32 +3,3 @@ annotations:
parsed_type:
type: std
name: datetime.datetime
old_chat_member: &chat-member-type
parsed_type:
type: union
items:
- type: entity
references:
category: types
name: ChatMemberOwner
- type: entity
references:
category: types
name: ChatMemberAdministrator
- type: entity
references:
category: types
name: ChatMemberMember
- type: entity
references:
category: types
name: ChatMemberRestricted
- type: entity
references:
category: types
name: ChatMemberLeft
- type: entity
references:
category: types
name: ChatMemberBanned
new_chat_member: *chat-member-type

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InlineQueryResult

View file

@ -1,6 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,5 +1,3 @@
bases:
- InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InputMessageContent

View file

@ -1,2 +0,0 @@
bases:
- InputMessageContent

View file

@ -1,2 +0,0 @@
bases:
- InputMessageContent

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -1,5 +1,3 @@
bases:
- InputMedia
annotations:
media:
parsed_type:

View file

@ -1,5 +1,3 @@
bases:
- InputMedia
annotations:
media:
parsed_type:

View file

@ -1,5 +1,3 @@
bases:
- InputMedia
annotations:
media:
parsed_type:

View file

@ -1,5 +1,3 @@
bases:
- InputMedia
annotations:
media:
parsed_type:

View file

@ -1,5 +1,3 @@
bases:
- InputMedia
annotations:
media:
parsed_type:

View file

@ -0,0 +1 @@
{ }

View file

@ -1,6 +1,3 @@
bases:
- InputMessageContent
annotations:
parse_mode:
value: UNSET_PARSE_MODE

View file

@ -1,2 +0,0 @@
bases:
- InputMessageContent

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -1,2 +0,0 @@
bases:
- MenuButton

View file

@ -1,2 +0,0 @@
bases:
- MenuButton

View file

@ -1,2 +0,0 @@
bases:
- MenuButton

View file

@ -0,0 +1 @@
discriminator: "source"

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

View file

@ -1,2 +0,0 @@
bases:
- PassportElementError

7
CHANGES/1213.bugfix.rst Normal file
View file

@ -0,0 +1,7 @@
Fixed the serialization error associated with nested subtypes
like InputMedia, ChatMember, etc.
The previously generated code resulted in an invalid schema under pydantic v2,
which has stricter type parsing.
Hence, subtypes without the specification of all subtype unions were generating
an empty object. This has been rectified now.

View file

@ -141,6 +141,13 @@ from ..types import (
UNSET_PARSE_MODE,
BotCommand,
BotCommandScope,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
BotDescription,
BotName,
BotShortDescription,
@ -161,9 +168,30 @@ from ..types import (
GameHighScore,
InlineKeyboardMarkup,
InlineQueryResult,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultContact,
InlineQueryResultDocument,
InlineQueryResultGame,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultsButton,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
InputFile,
InputMedia,
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
@ -579,7 +607,28 @@ class Bot(ContextInstanceMixin["Bot"]):
async def answer_web_app_query(
self,
web_app_query_id: str,
result: InlineQueryResult,
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
],
request_timeout: Optional[int] = None,
) -> SentWebAppMessage:
"""
@ -1073,7 +1122,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def delete_my_commands(
self,
scope: Optional[BotCommandScope] = None,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
@ -1282,7 +1341,13 @@ class Bot(ContextInstanceMixin["Bot"]):
async def edit_message_media(
self,
media: InputMedia,
media: Union[
InputMediaAnimation,
InputMediaDocument,
InputMediaAudio,
InputMediaPhoto,
InputMediaVideo,
],
chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
@ -1664,7 +1729,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def get_my_commands(
self,
scope: Optional[BotCommandScope] = None,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> List[BotCommand]:
@ -3077,7 +3152,7 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
chat_id: Optional[int] = None,
menu_button: Optional[
Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]
Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
] = None,
request_timeout: Optional[int] = None,
) -> bool:
@ -3234,7 +3309,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def set_my_commands(
self,
commands: List[BotCommand],
scope: Optional[BotCommandScope] = None,
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:

View file

@ -11,10 +11,7 @@ class BotContextController(BaseModel):
_bot: Optional["Bot"] = PrivateAttr()
def model_post_init(self, __context: Any) -> None:
if not __context:
self._bot = None
else:
self._bot = __context.get("bot")
self._bot = __context.get("bot") if __context else None
def as_(self, bot: Optional["Bot"]) -> Self:
"""

View file

@ -4,12 +4,14 @@ from .chat_member_status import ChatMemberStatus
from .chat_type import ChatType
from .content_type import ContentType
from .dice_emoji import DiceEmoji
from .encrypted_passport_element import EncryptedPassportElement
from .inline_query_result_type import InlineQueryResultType
from .input_media_type import InputMediaType
from .mask_position_point import MaskPositionPoint
from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType
from .parse_mode import ParseMode
from .passport_element_error_type import PassportElementErrorType
from .poll_type import PollType
from .sticker_format import StickerFormat
from .sticker_type import StickerType
@ -23,12 +25,14 @@ __all__ = (
"ChatType",
"ContentType",
"DiceEmoji",
"EncryptedPassportElement",
"InlineQueryResultType",
"InputMediaType",
"MaskPositionPoint",
"MenuButtonType",
"MessageEntityType",
"ParseMode",
"PassportElementErrorType",
"PollType",
"StickerFormat",
"StickerType",

View file

@ -0,0 +1,23 @@
from enum import Enum
class EncryptedPassportElement(str, Enum):
"""
This object represents type of encrypted passport element.
Source: https://core.telegram.org/bots/api#encryptedpassportelement
"""
PERSONAL_DETAILS = "personal_details"
PASSPORT = "passport"
DRIVER_LICENSE = "driver_license"
IDENTITY_CARD = "identity_card"
INTERNAL_PASSPORT = "internal_passport"
ADDRESS = "address"
UTILITY_BILL = "utility_bill"
BANK_STATEMENT = "bank_statement"
RENTAL_AGREEMENT = "rental_agreement"
PASSPORT_REGISTRATION = "passport_registration"
TEMPORARY_REGISTRATION = "temporary_registration"
PHONE_NUMBER = "phone_number"
EMAIL = "email"

View file

@ -0,0 +1,19 @@
from enum import Enum
class PassportElementErrorType(str, Enum):
"""
This object represents a passport element error type.
Source: https://core.telegram.org/bots/api#passportelementerror
"""
DATA = "data"
FRONT_SIDE = "front_side"
REVERSE_SIDE = "reverse_side"
SELFIE = "selfie"
FILE = "file"
FILES = "files"
TRANSLATION_FILE = "translation_file"
TRANSLATION_FILES = "translation_files"
UNSPECIFIED = "unspecified"

View file

@ -74,9 +74,12 @@ class _MemberStatusMarker:
return hash((self.name, self.is_member))
def check(self, *, member: ChatMember) -> bool:
if self.is_member is not None and member.is_member != self.is_member:
# Not all member types have `is_member` attribute
is_member = getattr(member, "is_member", None)
status = getattr(member, "status", None)
if self.is_member is not None and is_member != self.is_member:
return False
return self.name == member.status
return self.name == status
class _MemberStatusGroupMarker:

View file

@ -1,6 +1,30 @@
from __future__ import annotations
from ..types import InlineQueryResult, SentWebAppMessage
from typing import Union
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 .base import TelegramMethod
@ -16,5 +40,26 @@ class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
web_app_query_id: str
"""Unique identifier for the query to be answered"""
result: InlineQueryResult
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
"""A JSON-serialized object describing the message to be sent"""

View file

@ -1,8 +1,16 @@
from __future__ import annotations
from typing import Optional
from typing import Optional, Union
from ..types import BotCommandScope
from ..types import (
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -16,7 +24,17 @@ class DeleteMyCommands(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMyCommands"
scope: Optional[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = 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"""

View file

@ -2,7 +2,15 @@ from __future__ import annotations
from typing import Optional, Union
from ..types import InlineKeyboardMarkup, InputMedia, Message
from ..types import (
InlineKeyboardMarkup,
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
Message,
)
from .base import TelegramMethod
@ -16,7 +24,9 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool]
__api_method__ = "editMessageMedia"
media: InputMedia
media: Union[
InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
]
"""A JSON-serialized object for a new media content of the message"""
chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""

View file

@ -1,8 +1,17 @@
from __future__ import annotations
from typing import List, Optional
from typing import List, Optional, Union
from ..types import BotCommand, BotCommandScope
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -16,7 +25,17 @@ class GetMyCommands(TelegramMethod[List[BotCommand]]):
__returning__ = List[BotCommand]
__api_method__ = "getMyCommands"
scope: Optional[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = 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"""

View file

@ -18,5 +18,5 @@ 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[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]] = None
menu_button: Optional[Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]] = None
"""A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`"""

View file

@ -1,8 +1,17 @@
from __future__ import annotations
from typing import List, Optional
from typing import List, Optional, Union
from ..types import BotCommand, BotCommandScope
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -18,7 +27,17 @@ 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[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = 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"""

View file

@ -1,13 +1,7 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .user import User
class ChatMember(TelegramObject):
"""
@ -22,60 +16,3 @@ class ChatMember(TelegramObject):
Source: https://core.telegram.org/bots/api#chatmember
"""
status: str
"""The member's status in the chat"""
user: Optional[User] = None
"""*Optional*. Information about the user"""
is_anonymous: Optional[bool] = None
"""*Optional*. :code:`True`, if the user's presence in the chat is hidden"""
custom_title: Optional[str] = None
"""*Optional*. Custom title for this user"""
can_be_edited: Optional[bool] = None
"""*Optional*. :code:`True`, if the bot is allowed to edit administrator privileges of that user"""
can_manage_chat: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
can_delete_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can delete messages of other users"""
can_manage_video_chats: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can manage video chats"""
can_restrict_members: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can restrict, ban or unban chat members"""
can_promote_members: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)"""
can_change_info: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to change the chat title, photo and other settings"""
can_invite_users: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to invite new users to the chat"""
can_post_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can post in the channel; channels only"""
can_edit_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can edit messages of other users and can pin messages; channels only"""
can_pin_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to pin messages; groups and supergroups only"""
can_manage_topics: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only"""
is_member: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is a member of the chat at the moment of the request"""
can_send_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send text messages, contacts, invoices, locations and venues"""
can_send_audios: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send audios"""
can_send_documents: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send documents"""
can_send_photos: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send photos"""
can_send_videos: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send videos"""
can_send_video_notes: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send video notes"""
can_send_voice_notes: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send voice notes"""
can_send_polls: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send polls"""
can_send_other_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to send animations, games, stickers and use inline bots"""
can_add_web_page_previews: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to add web page previews to their messages"""
until_date: Optional[datetime.datetime] = None
"""*Optional*. Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever"""

View file

@ -1,13 +1,17 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Optional
from typing import TYPE_CHECKING, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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
class InlineQueryResultArticle(InlineQueryResult):
@ -23,7 +27,13 @@ class InlineQueryResultArticle(InlineQueryResult):
"""Unique identifier for this result, 1-64 Bytes"""
title: str
"""Title of the result"""
input_message_content: InputMessageContent
input_message_content: Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
"""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"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -40,5 +44,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the audio"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -34,5 +38,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the audio"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -38,5 +42,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the file"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -35,5 +39,13 @@ class InlineQueryResultCachedGif(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the GIF animation"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -35,5 +39,13 @@ class InlineQueryResultCachedMpeg4Gif(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the video animation"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -37,5 +41,13 @@ class InlineQueryResultCachedPhoto(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the photo"""

View file

@ -1,13 +1,17 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Optional
from typing import TYPE_CHECKING, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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
class InlineQueryResultCachedSticker(InlineQueryResult):
@ -26,5 +30,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the sticker"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -37,5 +41,13 @@ class InlineQueryResultCachedVideo(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the video"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -36,5 +40,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the voice message"""

View file

@ -1,13 +1,17 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Optional
from typing import TYPE_CHECKING, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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
class InlineQueryResultContact(InlineQueryResult):
@ -32,7 +36,15 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = 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"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -40,7 +44,15 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = 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"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -45,5 +49,13 @@ class InlineQueryResultGif(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the GIF animation"""

View file

@ -1,13 +1,17 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Optional
from typing import TYPE_CHECKING, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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
class InlineQueryResultLocation(InlineQueryResult):
@ -38,7 +42,15 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = 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"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -45,5 +49,13 @@ class InlineQueryResultMpeg4Gif(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the video animation"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -43,5 +47,13 @@ class InlineQueryResultPhoto(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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the photo"""

View file

@ -1,13 +1,17 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Optional
from typing import TYPE_CHECKING, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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
class InlineQueryResultVenue(InlineQueryResult):
@ -40,7 +44,15 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = 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"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -49,5 +53,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = 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)."""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, List, Literal, Optional, Union
from ..enums import InlineQueryResultType
from .base import UNSET_PARSE_MODE
@ -8,7 +8,11 @@ from .inline_query_result import InlineQueryResult
if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent
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 .message_entity import MessageEntity
@ -38,5 +42,13 @@ 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[InputMessageContent] = None
input_message_content: Optional[
Union[
InputTextMessageContent,
InputLocationMessageContent,
InputVenueMessageContent,
InputContactMessageContent,
InputInvoiceMessageContent,
]
] = None
"""*Optional*. Content of the message to be sent instead of the voice recording"""

View file

@ -67,7 +67,7 @@ if TYPE_CHECKING:
from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_file import InputFile
from .input_media import InputMedia
from .input_media_animation import InputMediaAnimation
from .input_media_audio import InputMediaAudio
from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto
@ -2774,7 +2774,13 @@ class Message(TelegramObject):
def edit_media(
self,
media: InputMedia,
media: Union[
InputMediaAnimation,
InputMediaDocument,
InputMediaAudio,
InputMediaPhoto,
InputMediaVideo,
],
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
**kwargs: Any,

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