mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 8.2 (#1623)
* Added full support of Bot API 8.2 * Added changelog * Try to add port * Add port to the `test_reset_connector`
This commit is contained in:
parent
81550997f7
commit
afccd8a38f
41 changed files with 811 additions and 85 deletions
|
|
@ -93,6 +93,8 @@ from ..methods import (
|
|||
PinChatMessage,
|
||||
PromoteChatMember,
|
||||
RefundStarPayment,
|
||||
RemoveChatVerification,
|
||||
RemoveUserVerification,
|
||||
ReopenForumTopic,
|
||||
ReopenGeneralForumTopic,
|
||||
ReplaceStickerInSet,
|
||||
|
|
@ -154,6 +156,8 @@ from ..methods import (
|
|||
UnpinAllGeneralForumTopicMessages,
|
||||
UnpinChatMessage,
|
||||
UploadStickerFile,
|
||||
VerifyChat,
|
||||
VerifyUser,
|
||||
)
|
||||
from ..types import (
|
||||
BotCommand,
|
||||
|
|
@ -3816,7 +3820,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success.
|
||||
Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code <https://en.wikipedia.org/wiki/List_of_HTTP_status_codes>`_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success.
|
||||
If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.
|
||||
|
||||
**Notes**
|
||||
|
|
@ -4373,8 +4377,8 @@ class Bot:
|
|||
|
||||
:param name: Sticker set name
|
||||
:param user_id: User identifier of the sticker set owner
|
||||
:param format: Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video
|
||||
:param thumbnail: A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
:param format: Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video
|
||||
:param thumbnail: A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
|
@ -4936,6 +4940,7 @@ class Bot:
|
|||
self,
|
||||
user_id: int,
|
||||
gift_id: str,
|
||||
pay_for_upgrade: Optional[bool] = None,
|
||||
text: Optional[str] = None,
|
||||
text_parse_mode: Optional[str] = None,
|
||||
text_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -4948,6 +4953,7 @@ class Bot:
|
|||
|
||||
:param user_id: Unique identifier of the target user that will receive the gift
|
||||
:param gift_id: Identifier of the gift
|
||||
:param pay_for_upgrade: Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
|
||||
:param text: Text that will be shown along with the gift; 0-255 characters
|
||||
:param text_parse_mode: Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
|
||||
:param text_entities: A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
|
||||
|
|
@ -4958,6 +4964,7 @@ class Bot:
|
|||
call = SendGift(
|
||||
user_id=user_id,
|
||||
gift_id=gift_id,
|
||||
pay_for_upgrade=pay_for_upgrade,
|
||||
text=text,
|
||||
text_parse_mode=text_parse_mode,
|
||||
text_entities=text_entities,
|
||||
|
|
@ -4991,3 +4998,89 @@ class Bot:
|
|||
emoji_status_expiration_date=emoji_status_expiration_date,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def remove_chat_verification(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removechatverification
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
||||
call = RemoveChatVerification(
|
||||
chat_id=chat_id,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def remove_user_verification(
|
||||
self,
|
||||
user_id: int,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removeuserverification
|
||||
|
||||
:param user_id: Unique identifier of the target user
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
||||
call = RemoveUserVerification(
|
||||
user_id=user_id,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def verify_chat(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
custom_description: Optional[str] = None,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifychat
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param custom_description: Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
||||
call = VerifyChat(
|
||||
chat_id=chat_id,
|
||||
custom_description=custom_description,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def verify_user(
|
||||
self,
|
||||
user_id: int,
|
||||
custom_description: Optional[str] = None,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifyuser
|
||||
|
||||
:param user_id: Unique identifier of the target user
|
||||
:param custom_description: Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
||||
call = VerifyUser(
|
||||
user_id=user_id,
|
||||
custom_description=custom_description,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ from .log_out import LogOut
|
|||
from .pin_chat_message import PinChatMessage
|
||||
from .promote_chat_member import PromoteChatMember
|
||||
from .refund_star_payment import RefundStarPayment
|
||||
from .remove_chat_verification import RemoveChatVerification
|
||||
from .remove_user_verification import RemoveUserVerification
|
||||
from .reopen_forum_topic import ReopenForumTopic
|
||||
from .reopen_general_forum_topic import ReopenGeneralForumTopic
|
||||
from .replace_sticker_in_set import ReplaceStickerInSet
|
||||
|
|
@ -130,6 +132,8 @@ from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
|
|||
from .unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .upload_sticker_file import UploadStickerFile
|
||||
from .verify_chat import VerifyChat
|
||||
from .verify_user import VerifyUser
|
||||
|
||||
__all__ = (
|
||||
"AddStickerToSet",
|
||||
|
|
@ -203,6 +207,8 @@ __all__ = (
|
|||
"PinChatMessage",
|
||||
"PromoteChatMember",
|
||||
"RefundStarPayment",
|
||||
"RemoveChatVerification",
|
||||
"RemoveUserVerification",
|
||||
"ReopenForumTopic",
|
||||
"ReopenGeneralForumTopic",
|
||||
"ReplaceStickerInSet",
|
||||
|
|
@ -266,4 +272,6 @@ __all__ = (
|
|||
"UnpinAllGeneralForumTopicMessages",
|
||||
"UnpinChatMessage",
|
||||
"UploadStickerFile",
|
||||
"VerifyChat",
|
||||
"VerifyUser",
|
||||
)
|
||||
|
|
|
|||
32
aiogram/methods/remove_chat_verification.py
Normal file
32
aiogram/methods/remove_chat_verification.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Union
|
||||
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class RemoveChatVerification(TelegramMethod[bool]):
|
||||
"""
|
||||
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removechatverification
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "removeChatVerification"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(chat_id=chat_id, **__pydantic_kwargs)
|
||||
30
aiogram/methods/remove_user_verification.py
Normal file
30
aiogram/methods/remove_user_verification.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class RemoveUserVerification(TelegramMethod[bool]):
|
||||
"""
|
||||
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removeuserverification
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "removeUserVerification"
|
||||
|
||||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(__pydantic__self__, *, user_id: int, **__pydantic_kwargs: Any) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(user_id=user_id, **__pydantic_kwargs)
|
||||
|
|
@ -20,6 +20,8 @@ class SendGift(TelegramMethod[bool]):
|
|||
"""Unique identifier of the target user that will receive the gift"""
|
||||
gift_id: str
|
||||
"""Identifier of the gift"""
|
||||
pay_for_upgrade: Optional[bool] = None
|
||||
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
|
||||
text: Optional[str] = None
|
||||
"""Text that will be shown along with the gift; 0-255 characters"""
|
||||
text_parse_mode: Optional[str] = None
|
||||
|
|
@ -36,6 +38,7 @@ class SendGift(TelegramMethod[bool]):
|
|||
*,
|
||||
user_id: int,
|
||||
gift_id: str,
|
||||
pay_for_upgrade: Optional[bool] = None,
|
||||
text: Optional[str] = None,
|
||||
text_parse_mode: Optional[str] = None,
|
||||
text_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -48,6 +51,7 @@ class SendGift(TelegramMethod[bool]):
|
|||
super().__init__(
|
||||
user_id=user_id,
|
||||
gift_id=gift_id,
|
||||
pay_for_upgrade=pay_for_upgrade,
|
||||
text=text,
|
||||
text_parse_mode=text_parse_mode,
|
||||
text_entities=text_entities,
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
|
|||
user_id: int
|
||||
"""User identifier of the sticker set owner"""
|
||||
format: str
|
||||
"""Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video"""
|
||||
"""Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video"""
|
||||
thumbnail: Optional[Union[InputFile, str]] = None
|
||||
"""A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."""
|
||||
"""A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .base import TelegramMethod
|
|||
|
||||
class SetWebhook(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success.
|
||||
Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code <https://en.wikipedia.org/wiki/List_of_HTTP_status_codes>`_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success.
|
||||
If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.
|
||||
|
||||
**Notes**
|
||||
|
|
|
|||
40
aiogram/methods/verify_chat.py
Normal file
40
aiogram/methods/verify_chat.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class VerifyChat(TelegramMethod[bool]):
|
||||
"""
|
||||
Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifychat
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "verifyChat"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
custom_description: Optional[str] = None
|
||||
"""Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
chat_id: Union[int, str],
|
||||
custom_description: Optional[str] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
chat_id=chat_id, custom_description=custom_description, **__pydantic_kwargs
|
||||
)
|
||||
40
aiogram/methods/verify_user.py
Normal file
40
aiogram/methods/verify_user.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class VerifyUser(TelegramMethod[bool]):
|
||||
"""
|
||||
Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifyuser
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "verifyUser"
|
||||
|
||||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
custom_description: Optional[str] = None
|
||||
"""Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
user_id: int,
|
||||
custom_description: Optional[str] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
user_id=user_id, custom_description=custom_description, **__pydantic_kwargs
|
||||
)
|
||||
|
|
@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class BackgroundTypePattern(BackgroundType):
|
||||
"""
|
||||
The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.
|
||||
The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#backgroundtypepattern
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class Gift(TelegramObject):
|
|||
"""The sticker that represents the gift"""
|
||||
star_count: int
|
||||
"""The number of Telegram Stars that must be paid to send the sticker"""
|
||||
upgrade_star_count: Optional[int] = None
|
||||
"""*Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one"""
|
||||
total_count: Optional[int] = None
|
||||
"""*Optional*. The total number of the gifts of this type that can be sent; for limited gifts only"""
|
||||
remaining_count: Optional[int] = None
|
||||
|
|
@ -36,6 +38,7 @@ class Gift(TelegramObject):
|
|||
id: str,
|
||||
sticker: Sticker,
|
||||
star_count: int,
|
||||
upgrade_star_count: Optional[int] = None,
|
||||
total_count: Optional[int] = None,
|
||||
remaining_count: Optional[int] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
|
|
@ -48,6 +51,7 @@ class Gift(TelegramObject):
|
|||
id=id,
|
||||
sticker=sticker,
|
||||
star_count=star_count,
|
||||
upgrade_star_count=upgrade_star_count,
|
||||
total_count=total_count,
|
||||
remaining_count=remaining_count,
|
||||
**__pydantic_kwargs,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InlineQueryResultType
|
||||
from .inline_query_result import InlineQueryResult
|
||||
|
||||
|
|
@ -39,8 +41,6 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
|
||||
url: Optional[str] = None
|
||||
"""*Optional*. URL of the result"""
|
||||
hide_url: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message"""
|
||||
description: Optional[str] = None
|
||||
"""*Optional*. Short description of the result"""
|
||||
thumbnail_url: Optional[str] = None
|
||||
|
|
@ -49,6 +49,11 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
"""*Optional*. Thumbnail width"""
|
||||
thumbnail_height: Optional[int] = None
|
||||
"""*Optional*. Thumbnail height"""
|
||||
hide_url: Optional[bool] = Field(None, json_schema_extra={"deprecated": True})
|
||||
"""*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message
|
||||
|
||||
.. deprecated:: API:8.2
|
||||
https://core.telegram.org/bots/api-changelog#january-1-2025"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -69,11 +74,11 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
],
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||
url: Optional[str] = None,
|
||||
hide_url: Optional[bool] = None,
|
||||
description: Optional[str] = None,
|
||||
thumbnail_url: Optional[str] = None,
|
||||
thumbnail_width: Optional[int] = None,
|
||||
thumbnail_height: Optional[int] = None,
|
||||
hide_url: Optional[bool] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -87,10 +92,10 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
input_message_content=input_message_content,
|
||||
reply_markup=reply_markup,
|
||||
url=url,
|
||||
hide_url=hide_url,
|
||||
description=description,
|
||||
thumbnail_url=thumbnail_url,
|
||||
thumbnail_width=thumbnail_width,
|
||||
thumbnail_height=thumbnail_height,
|
||||
hide_url=hide_url,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
id: str
|
||||
"""Unique identifier for this result, 1-64 bytes"""
|
||||
gif_url: str
|
||||
"""A valid URL for the GIF file. File size must not exceed 1MB"""
|
||||
"""A valid URL for the GIF file"""
|
||||
thumbnail_url: str
|
||||
"""URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
|
||||
gif_width: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
id: str
|
||||
"""Unique identifier for this result, 1-64 bytes"""
|
||||
mpeg4_url: str
|
||||
"""A valid URL for the MPEG4 file. File size must not exceed 1MB"""
|
||||
"""A valid URL for the MPEG4 file"""
|
||||
thumbnail_url: str
|
||||
"""URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
|
||||
mpeg4_width: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class InputSticker(TelegramObject):
|
|||
sticker: Union[InputFile, str]
|
||||
"""The added sticker. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. :ref:`More information on Sending Files » <sending-files>`"""
|
||||
format: str
|
||||
"""Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **WEBM** video"""
|
||||
"""Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video"""
|
||||
emoji_list: list[str]
|
||||
"""List of 1-20 emoji associated with the sticker"""
|
||||
mask_position: Optional[MaskPosition] = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue