Added full support of Bot API 7.2 (#1444)

* Added base support of Bot API 7.2

* Added base support of Bot API 7.2

* Fixing tests and content types for Telegram Bot API 7.2 update (#1453)

* Fixing tests and content types for Telegram Bot API 7.2

* Adding changelog for 1453 PR

* Fixes + coverage

* Replace `BusinessConnection.date` type

* Reformat code

* Refactor UserContextMiddleware to use EventContext class

This update significantly refactors UserContextMiddleware to leverage a new class, EventContext. Instead of resolving event context as a tuple, it now produces an instance of EventContext. Additional adjustments include supporting a business connection ID for event context identification and facilitating backwards compatibility. Tests and other files were also updated accordingly for these changes.

* Cover FSM key builder (business_connection_id

* Added changelog

---------

Co-authored-by: RoLOQ <roman.fedunn@gmail.com>
This commit is contained in:
Alex Root Junior 2024-04-22 13:48:49 +03:00 committed by GitHub
parent 5f157beb26
commit 057478621b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 3509 additions and 651 deletions

View file

@ -38,6 +38,7 @@ from .edit_message_text import EditMessageText
from .export_chat_invite_link import ExportChatInviteLink
from .forward_message import ForwardMessage
from .forward_messages import ForwardMessages
from .get_business_connection import GetBusinessConnection
from .get_chat import GetChat
from .get_chat_administrators import GetChatAdministrators
from .get_chat_member import GetChatMember
@ -65,6 +66,7 @@ from .pin_chat_message import PinChatMessage
from .promote_chat_member import PromoteChatMember
from .reopen_forum_topic import ReopenForumTopic
from .reopen_general_forum_topic import ReopenGeneralForumTopic
from .replace_sticker_in_set import ReplaceStickerInSet
from .restrict_chat_member import RestrictChatMember
from .revoke_chat_invite_link import RevokeChatInviteLink
from .send_animation import SendAnimation
@ -159,6 +161,7 @@ __all__ = (
"ExportChatInviteLink",
"ForwardMessage",
"ForwardMessages",
"GetBusinessConnection",
"GetChat",
"GetChatAdministrators",
"GetChatMember",
@ -186,6 +189,7 @@ __all__ = (
"PromoteChatMember",
"ReopenForumTopic",
"ReopenGeneralForumTopic",
"ReplaceStickerInSet",
"Request",
"Response",
"RestrictChatMember",

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class AddStickerToSet(TelegramMethod[bool]):
"""
Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns :code:`True` on success.
Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#addstickertoset
"""

View file

@ -19,7 +19,7 @@ class CopyMessages(TelegramMethod[List[MessageId]]):
from_chat_id: Union[int, str]
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: List[int]
"""Identifiers of 1-100 messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None

View file

@ -2,6 +2,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, List, Optional
from pydantic import Field
from ..types import InputSticker
from .base import TelegramMethod
@ -24,12 +26,15 @@ class CreateNewStickerSet(TelegramMethod[bool]):
"""Sticker set title, 1-64 characters"""
stickers: List[InputSticker]
"""A JSON-serialized list of 1-50 initial stickers to be added to the sticker set"""
sticker_format: str
"""Format of stickers in the set, must be one of 'static', 'animated', 'video'"""
sticker_type: Optional[str] = None
"""Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created."""
needs_repainting: Optional[bool] = None
"""Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"""
sticker_format: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""Format of stickers in the set, must be one of 'static', 'animated', 'video'
.. deprecated:: API:7.2
https://core.telegram.org/bots/api-changelog#march-31-2024"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -42,9 +47,9 @@ class CreateNewStickerSet(TelegramMethod[bool]):
name: str,
title: str,
stickers: List[InputSticker],
sticker_format: str,
sticker_type: Optional[str] = None,
needs_repainting: Optional[bool] = None,
sticker_format: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -56,8 +61,8 @@ class CreateNewStickerSet(TelegramMethod[bool]):
name=name,
title=title,
stickers=stickers,
sticker_format=sticker_format,
sticker_type=sticker_type,
needs_repainting=needs_repainting,
sticker_format=sticker_format,
**__pydantic_kwargs,
)

View file

@ -16,7 +16,7 @@ class DeleteMessages(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_ids: List[int]
"""Identifiers of 1-100 messages to delete. See :class:`aiogram.methods.delete_message.DeleteMessage` for limitations on which messages can be deleted"""
"""A JSON-serialized list of 1-100 identifiers of messages to delete. See :class:`aiogram.methods.delete_message.DeleteMessage` for limitations on which messages can be deleted"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -19,7 +19,7 @@ class ForwardMessages(TelegramMethod[List[MessageId]]):
from_chat_id: Union[int, str]
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: List[int]
"""Identifiers of 1-100 messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None

View file

@ -0,0 +1,34 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from aiogram.types import BusinessConnection
from .base import TelegramMethod
class GetBusinessConnection(TelegramMethod[BusinessConnection]):
"""
Use this method to get information about the connection of the bot with a business account. Returns a :class:`aiogram.types.business_connection.BusinessConnection` object on success.
Source: https://core.telegram.org/bots/api#getbusinessconnection
"""
__returning__ = BusinessConnection
__api_method__ = "getBusinessConnection"
business_connection_id: str
"""Unique identifier of the business connection"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, business_connection_id: 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__(business_connection_id=business_connection_id, **__pydantic_kwargs)

View file

@ -17,7 +17,7 @@ class GetCustomEmojiStickers(TelegramMethod[List[Sticker]]):
__api_method__ = "getCustomEmojiStickers"
custom_emoji_ids: List[str]
"""List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."""
"""A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -42,13 +42,13 @@ class PromoteChatMember(TelegramMethod[bool]):
can_delete_stories: Optional[bool] = None
"""Pass :code:`True` if the administrator can delete stories posted by other users"""
can_post_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; channels only"""
"""Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; for channels only"""
can_edit_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can edit messages of other users and can pin messages; channels only"""
"""Pass :code:`True` if the administrator can edit messages of other users and can pin messages; for channels only"""
can_pin_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can pin messages, supergroups only"""
"""Pass :code:`True` if the administrator can pin messages; for supergroups only"""
can_manage_topics: Optional[bool] = None
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics, supergroups only"""
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import InputSticker
from .base import TelegramMethod
class ReplaceStickerInSet(TelegramMethod[bool]):
"""
Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling :class:`aiogram.methods.delete_sticker_from_set.DeleteStickerFromSet`, then :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet`, then :class:`aiogram.methods.set_sticker_position_in_set.SetStickerPositionInSet`. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#replacestickerinset
"""
__returning__ = bool
__api_method__ = "replaceStickerInSet"
user_id: int
"""User identifier of the sticker set owner"""
name: str
"""Sticker set name"""
old_sticker: str
"""File identifier of the replaced sticker"""
sticker: InputSticker
"""A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
name: str,
old_sticker: str,
sticker: InputSticker,
**__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,
name=name,
old_sticker=old_sticker,
sticker=sticker,
**__pydantic_kwargs,
)

View file

@ -33,6 +33,8 @@ class SendAnimation(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
animation: Union[InputFile, str]
"""Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
duration: Optional[int] = None
@ -60,7 +62,7 @@ class SendAnimation(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -83,6 +85,7 @@ class SendAnimation(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
animation: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
@ -109,6 +112,7 @@ class SendAnimation(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
animation=animation,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
duration=duration,
width=width,

View file

@ -33,6 +33,8 @@ class SendAudio(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
audio: Union[InputFile, str]
"""Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
@ -58,7 +60,7 @@ class SendAudio(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -81,6 +83,7 @@ class SendAudio(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
audio: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -106,6 +109,7 @@ class SendAudio(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
audio=audio,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
caption=caption,
parse_mode=parse_mode,

View file

@ -23,8 +23,10 @@ class SendChatAction(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the action will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread; supergroups only"""
"""Unique identifier for the target message thread; for supergroups only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -35,6 +37,7 @@ class SendChatAction(TelegramMethod[bool]):
*,
chat_id: Union[int, str],
action: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
@ -45,6 +48,7 @@ class SendChatAction(TelegramMethod[bool]):
super().__init__(
chat_id=chat_id,
action=action,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
**__pydantic_kwargs,
)

View file

@ -32,6 +32,8 @@ class SendContact(TelegramMethod[Message]):
"""Contact's phone number"""
first_name: str
"""Contact's first name"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
last_name: Optional[str] = None
@ -47,7 +49,7 @@ class SendContact(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -71,6 +73,7 @@ class SendContact(TelegramMethod[Message]):
chat_id: Union[int, str],
phone_number: str,
first_name: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
last_name: Optional[str] = None,
vcard: Optional[str] = None,
@ -92,6 +95,7 @@ class SendContact(TelegramMethod[Message]):
chat_id=chat_id,
phone_number=phone_number,
first_name=first_name,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
last_name=last_name,
vcard=vcard,

View file

@ -28,6 +28,8 @@ class SendDice(TelegramMethod[Message]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
emoji: Optional[str] = None
@ -41,7 +43,7 @@ class SendDice(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -63,6 +65,7 @@ class SendDice(TelegramMethod[Message]):
__pydantic__self__,
*,
chat_id: Union[int, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
@ -81,6 +84,7 @@ class SendDice(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
emoji=emoji,
disable_notification=disable_notification,

View file

@ -33,6 +33,8 @@ class SendDocument(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
document: Union[InputFile, str]
"""File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
thumbnail: Optional[InputFile] = None
@ -54,7 +56,7 @@ class SendDocument(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -77,6 +79,7 @@ class SendDocument(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
document: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
caption: Optional[str] = None,
@ -100,6 +103,7 @@ class SendDocument(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
document=document,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
thumbnail=thumbnail,
caption=caption,

View file

@ -23,6 +23,8 @@ class SendGame(TelegramMethod[Message]):
"""Unique identifier for the target chat"""
game_short_name: str
"""Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather <https://t.me/botfather>`_."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
@ -32,7 +34,7 @@ class SendGame(TelegramMethod[Message]):
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."""
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. Not supported for messages sent on behalf of a business account."""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -55,6 +57,7 @@ class SendGame(TelegramMethod[Message]):
*,
chat_id: int,
game_short_name: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
@ -71,6 +74,7 @@ class SendGame(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
game_short_name=game_short_name,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
protect_content=protect_content,

View file

@ -32,6 +32,8 @@ class SendLocation(TelegramMethod[Message]):
"""Latitude of the location"""
longitude: float
"""Longitude of the location"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
horizontal_accuracy: Optional[float] = None
@ -51,7 +53,7 @@ class SendLocation(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -75,6 +77,7 @@ class SendLocation(TelegramMethod[Message]):
chat_id: Union[int, str],
latitude: float,
longitude: float,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
horizontal_accuracy: Optional[float] = None,
live_period: Optional[int] = None,
@ -98,6 +101,7 @@ class SendLocation(TelegramMethod[Message]):
chat_id=chat_id,
latitude=latitude,
longitude=longitude,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
horizontal_accuracy=horizontal_accuracy,
live_period=live_period,

View file

@ -6,11 +6,15 @@ from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
Message,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
)
from .base import TelegramMethod
@ -30,6 +34,8 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]]
"""A JSON-serialized array describing messages to be sent, must include 2-10 items"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
@ -62,6 +68,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
media: List[
Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]
],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
@ -77,6 +84,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
super().__init__(
chat_id=chat_id,
media=media,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
protect_content=protect_content,

View file

@ -32,6 +32,8 @@ class SendMessage(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
text: str
"""Text of the message to be sent, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
@ -49,7 +51,7 @@ class SendMessage(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -79,6 +81,7 @@ class SendMessage(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
text: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
entities: Optional[List[MessageEntity]] = None,
@ -105,6 +108,7 @@ class SendMessage(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
text=text,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
parse_mode=parse_mode,
entities=entities,

View file

@ -33,6 +33,8 @@ class SendPhoto(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
photo: Union[InputFile, str]
"""Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
@ -52,7 +54,7 @@ class SendPhoto(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -75,6 +77,7 @@ class SendPhoto(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
photo: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -97,6 +100,7 @@ class SendPhoto(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
photo=photo,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
caption=caption,
parse_mode=parse_mode,

View file

@ -35,6 +35,8 @@ class SendPoll(TelegramMethod[Message]):
"""Poll question, 1-300 characters"""
options: List[str]
"""A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
is_anonymous: Optional[bool] = None
@ -66,7 +68,7 @@ class SendPoll(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -90,6 +92,7 @@ class SendPoll(TelegramMethod[Message]):
chat_id: Union[int, str],
question: str,
options: List[str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
is_anonymous: Optional[bool] = None,
type: Optional[str] = None,
@ -119,6 +122,7 @@ class SendPoll(TelegramMethod[Message]):
chat_id=chat_id,
question=question,
options=options,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
is_anonymous=is_anonymous,
type=type,

View file

@ -30,7 +30,9 @@ class SendSticker(TelegramMethod[Message]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sticker: Union[InputFile, str]
"""Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Video stickers can only be sent by a file_id. Animated stickers can't be sent via an HTTP URL."""
"""Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Video and animated stickers can't be sent via an HTTP URL."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
emoji: Optional[str] = None
@ -44,7 +46,7 @@ class SendSticker(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account."""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -67,6 +69,7 @@ class SendSticker(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
sticker: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
@ -86,6 +89,7 @@ class SendSticker(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
sticker=sticker,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
emoji=emoji,
disable_notification=disable_notification,

View file

@ -36,6 +36,8 @@ class SendVenue(TelegramMethod[Message]):
"""Name of the venue"""
address: str
"""Address of the venue"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
foursquare_id: Optional[str] = None
@ -55,7 +57,7 @@ class SendVenue(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -81,6 +83,7 @@ class SendVenue(TelegramMethod[Message]):
longitude: float,
title: str,
address: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
foursquare_id: Optional[str] = None,
foursquare_type: Optional[str] = None,
@ -106,6 +109,7 @@ class SendVenue(TelegramMethod[Message]):
longitude=longitude,
title=title,
address=address,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
foursquare_id=foursquare_id,
foursquare_type=foursquare_type,

View file

@ -33,6 +33,8 @@ class SendVideo(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video: Union[InputFile, str]
"""Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
duration: Optional[int] = None
@ -62,7 +64,7 @@ class SendVideo(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -85,6 +87,7 @@ class SendVideo(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
video: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
@ -112,6 +115,7 @@ class SendVideo(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
video=video,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
duration=duration,
width=width,

View file

@ -31,6 +31,8 @@ class SendVideoNote(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video_note: Union[InputFile, str]
"""Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Sending video notes by a URL is currently unsupported"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
duration: Optional[int] = None
@ -48,7 +50,7 @@ class SendVideoNote(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -71,6 +73,7 @@ class SendVideoNote(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
video_note: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
length: Optional[int] = None,
@ -92,6 +95,7 @@ class SendVideoNote(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
video_note=video_note,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
duration=duration,
length=length,

View file

@ -33,6 +33,8 @@ class SendVoice(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
voice: Union[InputFile, str]
"""Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
@ -52,7 +54,7 @@ class SendVoice(TelegramMethod[Message]):
reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user."""
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
@ -75,6 +77,7 @@ class SendVoice(TelegramMethod[Message]):
*,
chat_id: Union[int, str],
voice: Union[InputFile, str],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -97,6 +100,7 @@ class SendVoice(TelegramMethod[Message]):
super().__init__(
chat_id=chat_id,
voice=voice,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
caption=caption,
parse_mode=parse_mode,

View file

@ -19,7 +19,7 @@ class SetMessageReaction(TelegramMethod[bool]):
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]]] = None
"""New 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."""
"""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."""
is_big: Optional[bool] = None
"""Pass :code:`True` to set the reaction with a big animation"""

View file

@ -20,6 +20,8 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
"""Sticker set name"""
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"""
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#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-requirements>`_`https://core.telegram.org/stickers#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-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-sticker-requirements <https://core.telegram.org/stickers#video-sticker-requirements>`_`https://core.telegram.org/stickers#video-sticker-requirements <https://core.telegram.org/stickers#video-sticker-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."""
@ -32,6 +34,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
*,
name: str,
user_id: int,
format: str,
thumbnail: Optional[Union[InputFile, str]] = None,
**__pydantic_kwargs: Any,
) -> None:
@ -39,4 +42,6 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(name=name, user_id=user_id, thumbnail=thumbnail, **__pydantic_kwargs)
super().__init__(
name=name, user_id=user_id, format=format, thumbnail=thumbnail, **__pydantic_kwargs
)

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class UploadStickerFile(TelegramMethod[File]):
"""
Use this method to upload a file with a sticker for later use in the :class:`aiogram.methods.create_new_sticker_set.CreateNewStickerSet` and :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet` methods (the file can be used multiple times). Returns the uploaded :class:`aiogram.types.file.File` on success.
Use this method to upload a file with a sticker for later use in the :class:`aiogram.methods.create_new_sticker_set.CreateNewStickerSet`, :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet`, or :class:`aiogram.methods.replace_sticker_in_set.ReplaceStickerInSet` methods (the file can be used multiple times). Returns the uploaded :class:`aiogram.types.file.File` on success.
Source: https://core.telegram.org/bots/api#uploadstickerfile
"""