Bot API 6.6 (#1139)

* Added basic support of Bot API 6.6

* Update descriptions

* Added StickerFormat enum

* Bump version

* Refresh from docs

* Fixed CommandStart

* Fixed files uploading

* Cover new functionality

* Added changelog

* Update texts
This commit is contained in:
Alex Root Junior 2023-03-11 02:17:47 +02:00 committed by GitHub
parent 5adaf7a567
commit 6570d0bab1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
218 changed files with 7687 additions and 1741 deletions

View file

@ -37,5 +37,5 @@ __all__ = (
"flags",
)
__version__ = "3.0.0b7"
__api_version__ = "6.5"
__version__ = "3.0.0b8"
__api_version__ = "6.6"

View file

@ -46,6 +46,7 @@ from ..methods import (
DeleteMessage,
DeleteMyCommands,
DeleteStickerFromSet,
DeleteStickerSet,
DeleteWebhook,
EditChatInviteLink,
EditForumTopic,
@ -69,6 +70,8 @@ from ..methods import (
GetMe,
GetMyCommands,
GetMyDefaultAdministratorRights,
GetMyDescription,
GetMyShortDescription,
GetStickerSet,
GetUpdates,
GetUserProfilePhotos,
@ -107,12 +110,19 @@ from ..methods import (
SetChatPhoto,
SetChatStickerSet,
SetChatTitle,
SetCustomEmojiStickerSetThumbnail,
SetGameScore,
SetMyCommands,
SetMyDefaultAdministratorRights,
SetMyDescription,
SetMyShortDescription,
SetPassportDataErrors,
SetStickerEmojiList,
SetStickerKeywords,
SetStickerMaskPosition,
SetStickerPositionInSet,
SetStickerSetThumb,
SetStickerSetThumbnail,
SetStickerSetTitle,
SetWebhook,
StopMessageLiveLocation,
StopPoll,
@ -129,6 +139,8 @@ from ..types import (
UNSET,
BotCommand,
BotCommandScope,
BotDescription,
BotShortDescription,
Chat,
ChatAdministratorRights,
ChatInviteLink,
@ -152,6 +164,7 @@ from ..types import (
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
InputSticker,
LabeledPrice,
MaskPosition,
MenuButtonCommands,
@ -396,25 +409,17 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
user_id: int,
name: str,
emojis: str,
png_sticker: Optional[Union[InputFile, str]] = None,
tgs_sticker: Optional[InputFile] = None,
webm_sticker: Optional[InputFile] = None,
mask_position: Optional[MaskPosition] = None,
sticker: InputSticker,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to add a new sticker to a set created by the bot. You **must** use exactly one of the fields *png_sticker*, *tgs_sticker*, or *webm_sticker*. Animated stickers can be added to animated sticker sets and only to them. Animated 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. 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.
Source: https://core.telegram.org/bots/api#addstickertoset
:param user_id: User identifier of sticker set owner
:param name: Sticker set name
:param emojis: One or more emoji corresponding to the sticker
:param png_sticker: **PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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>`
:param tgs_sticker: **TGS** animation with the sticker, uploaded using multipart/form-data. 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 technical requirements
:param webm_sticker: **WEBM** video with the sticker, uploaded using multipart/form-data. 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 technical requirements
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
:param sticker: 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 isn't changed.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
@ -422,11 +427,7 @@ class Bot(ContextInstanceMixin["Bot"]):
call = AddStickerToSet(
user_id=user_id,
name=name,
emojis=emojis,
png_sticker=png_sticker,
tgs_sticker=tgs_sticker,
webm_sticker=webm_sticker,
mask_position=mask_position,
sticker=sticker,
)
return await self(call, request_timeout=request_timeout)
@ -894,28 +895,24 @@ class Bot(ContextInstanceMixin["Bot"]):
user_id: int,
name: str,
title: str,
emojis: str,
png_sticker: Optional[Union[InputFile, str]] = None,
tgs_sticker: Optional[InputFile] = None,
webm_sticker: Optional[InputFile] = None,
stickers: List[InputSticker],
sticker_format: str,
sticker_type: Optional[str] = None,
mask_position: Optional[MaskPosition] = None,
needs_repainting: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You **must** use exactly one of the fields *png_sticker*, *tgs_sticker*, or *webm_sticker*. Returns :code:`True` on success.
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#createnewstickerset
:param user_id: User identifier of created sticker set owner
:param name: Short name of sticker set, to be used in :code:`t.me/addstickers/` URLs (e.g., *animals*). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in :code:`"_by_<bot_username>"`. :code:`<bot_username>` is case insensitive. 1-64 characters.
:param title: Sticker set title, 1-64 characters
:param emojis: One or more emoji corresponding to the sticker
:param png_sticker: **PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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>`
:param tgs_sticker: **TGS** animation with the sticker, uploaded using multipart/form-data. 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 technical requirements
:param webm_sticker: **WEBM** video with the sticker, uploaded using multipart/form-data. 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 technical requirements
:param sticker_type: Type of stickers in the set, pass 'regular' or 'mask'. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created.
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
:param stickers: A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
:param sticker_format: Format of stickers in the set, must be one of 'static', 'animated', 'video'
:param sticker_type: Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created.
:param needs_repainting: 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
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
@ -924,12 +921,10 @@ class Bot(ContextInstanceMixin["Bot"]):
user_id=user_id,
name=name,
title=title,
emojis=emojis,
png_sticker=png_sticker,
tgs_sticker=tgs_sticker,
webm_sticker=webm_sticker,
stickers=stickers,
sticker_format=sticker_format,
sticker_type=sticker_type,
mask_position=mask_position,
needs_repainting=needs_repainting,
)
return await self(call, request_timeout=request_timeout)
@ -1998,7 +1993,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -2023,7 +2018,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param duration: Duration of sent animation in seconds
:param width: Animation width
:param height: Animation height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -2044,7 +2039,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -2068,7 +2063,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration: Optional[int] = None,
performer: Optional[str] = None,
title: Optional[str] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -2093,7 +2088,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param duration: Duration of the audio in seconds
:param performer: Performer
:param title: Track name
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -2113,7 +2108,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration=duration,
performer=performer,
title=title,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
@ -2252,7 +2247,7 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id: Union[int, str],
document: Union[InputFile, str],
message_thread_id: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -2274,7 +2269,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param document: 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>`
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -2292,7 +2287,7 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id=chat_id,
document=document,
message_thread_id=message_thread_id,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -2731,6 +2726,7 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id: Union[int, str],
sticker: Union[InputFile, str],
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -2746,8 +2742,9 @@ class Bot(ContextInstanceMixin["Bot"]):
Source: https://core.telegram.org/bots/api#sendsticker
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param sticker: 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`
:param sticker: 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.
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -2761,6 +2758,7 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id=chat_id,
sticker=sticker,
message_thread_id=message_thread_id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
@ -2841,7 +2839,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -2867,7 +2865,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param duration: Duration of sent video in seconds
:param width: Video width
:param height: Video height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -2889,7 +2887,7 @@ class Bot(ContextInstanceMixin["Bot"]):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -2910,7 +2908,7 @@ class Bot(ContextInstanceMixin["Bot"]):
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
length: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -2930,7 +2928,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
:param duration: Duration of sent video in seconds
:param length: Video width and height, i.e. diameter of the video message
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -2946,7 +2944,7 @@ class Bot(ContextInstanceMixin["Bot"]):
message_thread_id=message_thread_id,
duration=duration,
length=length,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
@ -3250,7 +3248,7 @@ class Bot(ContextInstanceMixin["Bot"]):
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns :code:`True` on success.
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmydefaultadministratorrights
@ -3313,32 +3311,6 @@ class Bot(ContextInstanceMixin["Bot"]):
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_set_thumb(
self,
name: str,
user_id: int,
thumb: Optional[Union[InputFile, str]] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersetthumb
:param name: Sticker set name
:param user_id: User identifier of the sticker set owner
:param thumb: A **PNG** image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a **TGS** animation with the 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 sticker set thumbnails can't be uploaded via HTTP URL.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerSetThumb(
name=name,
user_id=user_id,
thumb=thumb,
)
return await self(call, request_timeout=request_timeout)
async def set_webhook(
self,
url: str,
@ -3560,23 +3532,26 @@ class Bot(ContextInstanceMixin["Bot"]):
async def upload_sticker_file(
self,
user_id: int,
png_sticker: InputFile,
sticker: InputFile,
sticker_format: str,
request_timeout: Optional[int] = None,
) -> File:
"""
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (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` 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.
Source: https://core.telegram.org/bots/api#uploadstickerfile
:param user_id: User identifier of sticker file owner
:param png_sticker: **PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. :ref:`More information on Sending Files » <sending-files>`
:param sticker: A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See `https://core.telegram.org/stickers <https://core.telegram.org/stickers>`_`https://core.telegram.org/stickers <https://core.telegram.org/stickers>`_ for technical requirements. :ref:`More information on Sending Files » <sending-files>`
:param sticker_format: Format of the sticker, must be one of 'static', 'animated', 'video'
:param request_timeout: Request timeout
:return: Returns the uploaded :class:`aiogram.types.file.File` on success.
"""
call = UploadStickerFile(
user_id=user_id,
png_sticker=png_sticker,
sticker=sticker,
sticker_format=sticker_format,
)
return await self(call, request_timeout=request_timeout)
@ -3682,3 +3657,250 @@ class Bot(ContextInstanceMixin["Bot"]):
chat_id=chat_id,
)
return await self(call, request_timeout=request_timeout)
async def delete_sticker_set(
self,
name: str,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to delete a sticker set that was created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestickerset
:param name: Sticker set name
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = DeleteStickerSet(
name=name,
)
return await self(call, request_timeout=request_timeout)
async def get_my_description(
self,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> BotDescription:
"""
Use this method to get the current bot description for the given user language. Returns :class:`aiogram.types.bot_description.BotDescription` on success.
Source: https://core.telegram.org/bots/api#getmydescription
:param language_code: A two-letter ISO 639-1 language code or an empty string
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.bot_description.BotDescription` on success.
"""
call = GetMyDescription(
language_code=language_code,
)
return await self(call, request_timeout=request_timeout)
async def get_my_short_description(
self,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> BotShortDescription:
"""
Use this method to get the current bot short description for the given user language. Returns :class:`aiogram.types.bot_short_description.BotShortDescription` on success.
Source: https://core.telegram.org/bots/api#getmyshortdescription
:param language_code: A two-letter ISO 639-1 language code or an empty string
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.bot_short_description.BotShortDescription` on success.
"""
call = GetMyShortDescription(
language_code=language_code,
)
return await self(call, request_timeout=request_timeout)
async def set_custom_emoji_sticker_set_thumbnail(
self,
name: str,
custom_emoji_id: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to set the thumbnail of a custom emoji sticker set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
:param name: Sticker set name
:param custom_emoji_id: Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetCustomEmojiStickerSetThumbnail(
name=name,
custom_emoji_id=custom_emoji_id,
)
return await self(call, request_timeout=request_timeout)
async def set_my_description(
self,
description: Optional[str] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmydescription
:param description: New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
:param language_code: A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetMyDescription(
description=description,
language_code=language_code,
)
return await self(call, request_timeout=request_timeout)
async def set_my_short_description(
self,
short_description: Optional[str] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmyshortdescription
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
:param language_code: A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetMyShortDescription(
short_description=short_description,
language_code=language_code,
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_emoji_list(
self,
sticker: str,
emoji_list: List[str],
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickeremojilist
:param sticker: File identifier of the sticker
:param emoji_list: A JSON-serialized list of 1-20 emoji associated with the sticker
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerEmojiList(
sticker=sticker,
emoji_list=emoji_list,
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_keywords(
self,
sticker: str,
keywords: Optional[List[str]] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickerkeywords
:param sticker: File identifier of the sticker
:param keywords: A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerKeywords(
sticker=sticker,
keywords=keywords,
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_mask_position(
self,
sticker: str,
mask_position: Optional[MaskPosition] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to change the `mask position <https://core.telegram.org/bots/api#maskposition>`_ of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickermaskposition
:param sticker: File identifier of the sticker
:param mask_position: A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerMaskPosition(
sticker=sticker,
mask_position=mask_position,
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_set_thumbnail(
self,
name: str,
user_id: int,
thumbnail: Optional[Union[InputFile, str]] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersetthumbnail
:param name: Sticker set name
:param user_id: User identifier of the sticker set owner
: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#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.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerSetThumbnail(
name=name,
user_id=user_id,
thumbnail=thumbnail,
)
return await self(call, request_timeout=request_timeout)
async def set_sticker_set_title(
self,
name: str,
title: str,
request_timeout: Optional[int] = None,
) -> bool:
"""
Use this method to set the title of a created sticker set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersettitle
:param name: Sticker set name
:param title: Sticker set title, 1-64 characters
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetStickerSetTitle(
name=name,
title=title,
)
return await self(call, request_timeout=request_timeout)

View file

@ -23,6 +23,7 @@ from aiogram.methods import Request, TelegramMethod
from ...exceptions import TelegramNetworkError
from ...methods.base import TelegramType
from ...types import InputFile
from .base import UNSET, BaseSession
if TYPE_CHECKING:

View file

@ -11,6 +11,7 @@ from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType
from .parse_mode import ParseMode
from .poll_type import PollType
from .sticker_format import StickerFormat
from .sticker_type import StickerType
from .topic_icon_color import TopicIconColor
from .update_type import UpdateType
@ -29,6 +30,7 @@ __all__ = (
"MessageEntityType",
"ParseMode",
"PollType",
"StickerFormat",
"StickerType",
"TopicIconColor",
"UpdateType",

View file

@ -3,9 +3,9 @@ from enum import Enum
class InlineQueryResultType(str, Enum):
"""
The part of the face relative to which the mask should be placed.
Type of inline query result
Source: https://core.telegram.org/bots/api#maskposition
Source: https://core.telegram.org/bots/api#inlinequeryresult
"""
AUDIO = "audio"

View file

@ -0,0 +1,13 @@
from enum import Enum
class StickerFormat(str, Enum):
"""
Format of the sticker
Source: https://core.telegram.org/bots/api#createnewstickerset
"""
STATIC = "static"
ANIMATED = "animated"
VIDEO = "video"

View file

@ -279,8 +279,8 @@ class CommandStart(Command):
await self.validate_mention(bot=bot, command=command)
command = self.validate_command(command)
command = self.validate_deeplink(command=command)
self.do_magic(command=command)
return command
command = self.do_magic(command=command)
return command # noqa: RET504
def validate_deeplink(self, command: CommandObject) -> CommandObject:
if not self.deep_link:

View file

@ -23,6 +23,7 @@ from .delete_forum_topic import DeleteForumTopic
from .delete_message import DeleteMessage
from .delete_my_commands import DeleteMyCommands
from .delete_sticker_from_set import DeleteStickerFromSet
from .delete_sticker_set import DeleteStickerSet
from .delete_webhook import DeleteWebhook
from .edit_chat_invite_link import EditChatInviteLink
from .edit_forum_topic import EditForumTopic
@ -46,6 +47,8 @@ from .get_game_high_scores import GetGameHighScores
from .get_me import GetMe
from .get_my_commands import GetMyCommands
from .get_my_default_administrator_rights import GetMyDefaultAdministratorRights
from .get_my_description import GetMyDescription
from .get_my_short_description import GetMyShortDescription
from .get_sticker_set import GetStickerSet
from .get_updates import GetUpdates
from .get_user_profile_photos import GetUserProfilePhotos
@ -84,12 +87,19 @@ from .set_chat_permissions import SetChatPermissions
from .set_chat_photo import SetChatPhoto
from .set_chat_sticker_set import SetChatStickerSet
from .set_chat_title import SetChatTitle
from .set_custom_emoji_sticker_set_thumbnail import SetCustomEmojiStickerSetThumbnail
from .set_game_score import SetGameScore
from .set_my_commands import SetMyCommands
from .set_my_default_administrator_rights import SetMyDefaultAdministratorRights
from .set_my_description import SetMyDescription
from .set_my_short_description import SetMyShortDescription
from .set_passport_data_errors import SetPassportDataErrors
from .set_sticker_emoji_list import SetStickerEmojiList
from .set_sticker_keywords import SetStickerKeywords
from .set_sticker_mask_position import SetStickerMaskPosition
from .set_sticker_position_in_set import SetStickerPositionInSet
from .set_sticker_set_thumb import SetStickerSetThumb
from .set_sticker_set_thumbnail import SetStickerSetThumbnail
from .set_sticker_set_title import SetStickerSetTitle
from .set_webhook import SetWebhook
from .stop_message_live_location import StopMessageLiveLocation
from .stop_poll import StopPoll
@ -126,6 +136,7 @@ __all__ = (
"DeleteMessage",
"DeleteMyCommands",
"DeleteStickerFromSet",
"DeleteStickerSet",
"DeleteWebhook",
"EditChatInviteLink",
"EditForumTopic",
@ -149,6 +160,8 @@ __all__ = (
"GetMe",
"GetMyCommands",
"GetMyDefaultAdministratorRights",
"GetMyDescription",
"GetMyShortDescription",
"GetStickerSet",
"GetUpdates",
"GetUserProfilePhotos",
@ -189,12 +202,19 @@ __all__ = (
"SetChatPhoto",
"SetChatStickerSet",
"SetChatTitle",
"SetCustomEmojiStickerSetThumbnail",
"SetGameScore",
"SetMyCommands",
"SetMyDefaultAdministratorRights",
"SetMyDescription",
"SetMyShortDescription",
"SetPassportDataErrors",
"SetStickerEmojiList",
"SetStickerKeywords",
"SetStickerMaskPosition",
"SetStickerPositionInSet",
"SetStickerSetThumb",
"SetStickerSetThumbnail",
"SetStickerSetTitle",
"SetWebhook",
"StopMessageLiveLocation",
"StopPoll",

View file

@ -1,9 +1,9 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from typing import TYPE_CHECKING, Any, Dict
from ..types import InputFile, MaskPosition
from .base import Request, TelegramMethod, prepare_file
from ..types import InputFile, InputSticker
from .base import Request, TelegramMethod, prepare_input_sticker
if TYPE_CHECKING:
from ..client.bot import Bot
@ -11,7 +11,7 @@ if TYPE_CHECKING:
class AddStickerToSet(TelegramMethod[bool]):
"""
Use this method to add a new sticker to a set created by the bot. You **must** use exactly one of the fields *png_sticker*, *tgs_sticker*, or *webm_sticker*. Animated stickers can be added to animated sticker sets and only to them. Animated 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. 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.
Source: https://core.telegram.org/bots/api#addstickertoset
"""
@ -22,23 +22,13 @@ class AddStickerToSet(TelegramMethod[bool]):
"""User identifier of sticker set owner"""
name: str
"""Sticker set name"""
emojis: str
"""One or more emoji corresponding to the sticker"""
png_sticker: Optional[Union[InputFile, str]] = None
"""**PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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>`"""
tgs_sticker: Optional[InputFile] = None
"""**TGS** animation with the sticker, uploaded using multipart/form-data. 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 technical requirements"""
webm_sticker: Optional[InputFile] = None
"""**WEBM** video with the sticker, uploaded using multipart/form-data. 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 technical requirements"""
mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object for position where the mask should be placed on faces"""
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 isn't changed."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict(exclude={"png_sticker", "tgs_sticker", "webm_sticker"})
data: Dict[str, Any] = self.dict()
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
prepare_file(data=data, files=files, name="tgs_sticker", value=self.tgs_sticker)
prepare_file(data=data, files=files, name="webm_sticker", value=self.webm_sticker)
prepare_input_sticker(input_sticker=data["sticker"], files=files)
return Request(method="addStickerToSet", data=data, files=files)

View file

@ -100,10 +100,10 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[TelegramType]):
def prepare_file(name: str, value: Any, data: Dict[str, Any], files: Dict[str, Any]) -> None:
if not value:
return
if name == "thumb":
if name == "thumbnail":
tag = secrets.token_urlsafe(10)
files[tag] = value
data["thumb"] = f"attach://{tag}"
data["thumbnail"] = f"attach://{tag}"
elif isinstance(value, InputFile):
files[name] = value
else:
@ -122,6 +122,22 @@ def prepare_input_media(data: Dict[str, Any], files: Dict[str, InputFile]) -> No
input_media["media"] = f"attach://{tag}"
def prepare_input_sticker(input_sticker: Dict[str, Any], files: Dict[str, InputFile]) -> None:
if (
"sticker" in input_sticker
and input_sticker["sticker"]
and isinstance(input_sticker["sticker"], InputFile)
):
tag = secrets.token_urlsafe(10)
files[tag] = input_sticker.pop("sticker")
input_sticker["sticker"] = f"attach://{tag}"
def prepare_input_stickers(data: Dict[str, Any], files: Dict[str, InputFile]) -> None:
for input_sticker in data["stickers"]:
prepare_input_sticker(input_sticker, files=files)
def prepare_media_file(data: Dict[str, Any], files: Dict[str, InputFile]) -> None:
if (
data["media"]

View file

@ -1,9 +1,9 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from ..types import InputFile, MaskPosition
from .base import Request, TelegramMethod, prepare_file
from ..types import InputFile, InputSticker
from .base import Request, TelegramMethod, prepare_input_sticker, prepare_input_stickers
if TYPE_CHECKING:
from ..client.bot import Bot
@ -11,7 +11,7 @@ if TYPE_CHECKING:
class CreateNewStickerSet(TelegramMethod[bool]):
"""
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You **must** use exactly one of the fields *png_sticker*, *tgs_sticker*, or *webm_sticker*. Returns :code:`True` on success.
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#createnewstickerset
"""
@ -24,25 +24,19 @@ class CreateNewStickerSet(TelegramMethod[bool]):
"""Short name of sticker set, to be used in :code:`t.me/addstickers/` URLs (e.g., *animals*). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in :code:`"_by_<bot_username>"`. :code:`<bot_username>` is case insensitive. 1-64 characters."""
title: str
"""Sticker set title, 1-64 characters"""
emojis: str
"""One or more emoji corresponding to the sticker"""
png_sticker: Optional[Union[InputFile, str]] = None
"""**PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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>`"""
tgs_sticker: Optional[InputFile] = None
"""**TGS** animation with the sticker, uploaded using multipart/form-data. 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 technical requirements"""
webm_sticker: Optional[InputFile] = None
"""**WEBM** video with the sticker, uploaded using multipart/form-data. 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 technical requirements"""
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' or 'mask'. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created."""
mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object for position where the mask should be placed on faces"""
"""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"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict(exclude={"png_sticker", "tgs_sticker", "webm_sticker"})
data: Dict[str, Any] = self.dict()
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
prepare_file(data=data, files=files, name="tgs_sticker", value=self.tgs_sticker)
prepare_file(data=data, files=files, name="webm_sticker", value=self.webm_sticker)
prepare_input_stickers(data=data, files=files)
return Request(method="createNewStickerSet", data=data, files=files)

View file

@ -0,0 +1,26 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class DeleteStickerSet(TelegramMethod[bool]):
"""
Use this method to delete a sticker set that was created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestickerset
"""
__returning__ = bool
name: str
"""Sticker set name"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="deleteStickerSet", data=data)

View file

@ -0,0 +1,27 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from ..types import BotDescription
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class GetMyDescription(TelegramMethod[BotDescription]):
"""
Use this method to get the current bot description for the given user language. Returns :class:`aiogram.types.bot_description.BotDescription` on success.
Source: https://core.telegram.org/bots/api#getmydescription
"""
__returning__ = BotDescription
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="getMyDescription", data=data)

View file

@ -0,0 +1,27 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from ..types import BotShortDescription
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class GetMyShortDescription(TelegramMethod[BotShortDescription]):
"""
Use this method to get the current bot short description for the given user language. Returns :class:`aiogram.types.bot_short_description.BotShortDescription` on success.
Source: https://core.telegram.org/bots/api#getmyshortdescription
"""
__returning__ = BotShortDescription
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="getMyShortDescription", data=data)

View file

@ -39,7 +39,7 @@ class SendAnimation(TelegramMethod[Message]):
"""Animation width"""
height: Optional[int] = None
"""Animation height"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
@ -71,6 +71,6 @@ class SendAnimation(TelegramMethod[Message]):
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="animation", value=self.animation)
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
prepare_file(data=data, files=files, name="thumbnail", value=self.thumbnail)
return Request(method="sendAnimation", data=data, files=files)

View file

@ -46,7 +46,7 @@ class SendAudio(TelegramMethod[Message]):
"""Performer"""
title: Optional[str] = None
"""Track name"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
@ -70,6 +70,6 @@ class SendAudio(TelegramMethod[Message]):
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="audio", value=self.audio)
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
prepare_file(data=data, files=files, name="thumbnail", value=self.thumbnail)
return Request(method="sendAudio", data=data, files=files)

View file

@ -33,7 +33,7 @@ class SendDocument(TelegramMethod[Message]):
"""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>`"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
@ -65,6 +65,6 @@ class SendDocument(TelegramMethod[Message]):
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="document", value=self.document)
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
prepare_file(data=data, files=files, name="thumbnail", value=self.thumbnail)
return Request(method="sendDocument", data=data, files=files)

View file

@ -28,9 +28,11 @@ 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
"""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."""
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
"""Emoji associated with the sticker; only for just uploaded stickers"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None

View file

@ -39,7 +39,7 @@ class SendVideo(TelegramMethod[Message]):
"""Video width"""
height: Optional[int] = None
"""Video height"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing"""
@ -73,6 +73,6 @@ class SendVideo(TelegramMethod[Message]):
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="video", value=self.video)
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
prepare_file(data=data, files=files, name="thumbnail", value=self.thumbnail)
return Request(method="sendVideo", data=data, files=files)

View file

@ -35,7 +35,7 @@ class SendVideoNote(TelegramMethod[Message]):
"""Duration of sent video in seconds"""
length: Optional[int] = None
"""Video width and height, i.e. diameter of the video message"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
@ -55,6 +55,6 @@ class SendVideoNote(TelegramMethod[Message]):
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="video_note", value=self.video_note)
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
prepare_file(data=data, files=files, name="thumbnail", value=self.thumbnail)
return Request(method="sendVideoNote", data=data, files=files)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]):
"""
Use this method to set the thumbnail of a custom emoji sticker set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
"""
__returning__ = bool
name: str
"""Sticker set name"""
custom_emoji_id: Optional[str] = None
"""Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setCustomEmojiStickerSetThumbnail", data=data)

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class SetMyDefaultAdministratorRights(TelegramMethod[bool]):
"""
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns :code:`True` on success.
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmydefaultadministratorrights
"""

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetMyDescription(TelegramMethod[bool]):
"""
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmydescription
"""
__returning__ = bool
description: Optional[str] = None
"""New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setMyDescription", data=data)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetMyShortDescription(TelegramMethod[bool]):
"""
Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmyshortdescription
"""
__returning__ = bool
short_description: Optional[str] = None
"""New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setMyShortDescription", data=data)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerEmojiList(TelegramMethod[bool]):
"""
Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickeremojilist
"""
__returning__ = bool
sticker: str
"""File identifier of the sticker"""
emoji_list: List[str]
"""A JSON-serialized list of 1-20 emoji associated with the sticker"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setStickerEmojiList", data=data)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerKeywords(TelegramMethod[bool]):
"""
Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickerkeywords
"""
__returning__ = bool
sticker: str
"""File identifier of the sticker"""
keywords: Optional[List[str]] = None
"""A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setStickerKeywords", data=data)

View file

@ -0,0 +1,29 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from ..types import MaskPosition
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerMaskPosition(TelegramMethod[bool]):
"""
Use this method to change the `mask position <https://core.telegram.org/bots/api#maskposition>`_ of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickermaskposition
"""
__returning__ = bool
sticker: str
"""File identifier of the sticker"""
mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setStickerMaskPosition", data=data)

View file

@ -1,34 +0,0 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from ..types import InputFile
from .base import Request, TelegramMethod, prepare_file
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerSetThumb(TelegramMethod[bool]):
"""
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersetthumb
"""
__returning__ = bool
name: str
"""Sticker set name"""
user_id: int
"""User identifier of the sticker set owner"""
thumb: Optional[Union[InputFile, str]] = None
"""A **PNG** image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a **TGS** animation with the 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 sticker set thumbnails can't be uploaded via HTTP URL."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict(exclude={"thumb"})
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="thumb", value=self.thumb)
return Request(method="setStickerSetThumb", data=data, files=files)

View file

@ -0,0 +1,34 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from ..types import InputFile
from .base import Request, TelegramMethod, prepare_file
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerSetThumbnail(TelegramMethod[bool]):
"""
Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersetthumbnail
"""
__returning__ = bool
name: str
"""Sticker set name"""
user_id: int
"""User identifier of the sticker set owner"""
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."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
files: Dict[str, InputFile] = {}
prepare_file("thumbnail", value=self.thumbnail, data=data, files=files)
return Request(method="setStickerSetThumbnail", data=data)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class SetStickerSetTitle(TelegramMethod[bool]):
"""
Use this method to set the title of a created sticker set. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setstickersettitle
"""
__returning__ = bool
name: str
"""Sticker set name"""
title: str
"""Sticker set title, 1-64 characters"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setStickerSetTitle", data=data)

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class UploadStickerFile(TelegramMethod[File]):
"""
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (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` 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.
Source: https://core.telegram.org/bots/api#uploadstickerfile
"""
@ -20,13 +20,15 @@ class UploadStickerFile(TelegramMethod[File]):
user_id: int
"""User identifier of sticker file owner"""
png_sticker: InputFile
"""**PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. :ref:`More information on Sending Files » <sending-files>`"""
sticker: InputFile
"""A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See `https://core.telegram.org/stickers <https://core.telegram.org/stickers>`_`https://core.telegram.org/stickers <https://core.telegram.org/stickers>`_ for technical requirements. :ref:`More information on Sending Files » <sending-files>`"""
sticker_format: str
"""Format of the sticker, must be one of 'static', 'animated', 'video'"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict(exclude={"png_sticker"})
data: Dict[str, Any] = self.dict(exclude={"sticker"})
files: Dict[str, InputFile] = {}
prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
prepare_file(data=data, files=files, name="sticker", value=self.sticker)
return Request(method="uploadStickerFile", data=data, files=files)

View file

@ -14,6 +14,8 @@ from .bot_command_scope_chat import BotCommandScopeChat
from .bot_command_scope_chat_administrators import BotCommandScopeChatAdministrators
from .bot_command_scope_chat_member import BotCommandScopeChatMember
from .bot_command_scope_default import BotCommandScopeDefault
from .bot_description import BotDescription
from .bot_short_description import BotShortDescription
from .callback_game import CallbackGame
from .callback_query import CallbackQuery
from .chat import Chat
@ -86,6 +88,7 @@ from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto
from .input_media_video import InputMediaVideo
from .input_message_content import InputMessageContent
from .input_sticker import InputSticker
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .invoice import Invoice
@ -165,6 +168,8 @@ __all__ = (
"BotCommandScopeChatAdministrators",
"BotCommandScopeChatMember",
"BotCommandScopeDefault",
"BotDescription",
"BotShortDescription",
"BufferedInputFile",
"CallbackGame",
"CallbackQuery",
@ -240,6 +245,7 @@ __all__ = (
"InputMediaPhoto",
"InputMediaVideo",
"InputMessageContent",
"InputSticker",
"InputTextMessageContent",
"InputVenueMessageContent",
"Invoice",

View file

@ -25,7 +25,7 @@ class Animation(TelegramObject):
"""Video height as defined by sender"""
duration: int
"""Duration of the video in seconds as defined by sender"""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Animation thumbnail as defined by sender"""
file_name: Optional[str] = None
"""*Optional*. Original animation filename as defined by sender"""

View file

@ -31,5 +31,5 @@ class Audio(TelegramObject):
"""*Optional*. MIME type of the file as defined by sender"""
file_size: Optional[int] = None
"""*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Thumbnail of the album cover to which the music file belongs"""

View file

@ -0,0 +1,12 @@
from aiogram.types import TelegramObject
class BotDescription(TelegramObject):
"""
This object represents the bot's description.
Source: https://core.telegram.org/bots/api#botdescription
"""
description: str
"""The bot's description"""

View file

@ -0,0 +1,12 @@
from aiogram.types import TelegramObject
class BotShortDescription(TelegramObject):
"""
This object represents the bot's short description.
Source: https://core.telegram.org/bots/api#botshortdescription
"""
short_description: str
"""The bot's short description"""

View file

@ -19,7 +19,7 @@ class Document(TelegramObject):
"""Identifier for this file, which can be used to download or reuse the file"""
file_unique_id: str
"""Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Document thumbnail as defined by sender"""
file_name: Optional[str] = None
"""*Optional*. Original filename as defined by sender"""

View file

@ -35,9 +35,9 @@ class InlineQueryResultArticle(InlineQueryResult):
"""*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"""
thumb_url: Optional[str] = None
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
thumb_width: Optional[int] = None
thumbnail_width: Optional[int] = None
"""*Optional*. Thumbnail width"""
thumb_height: Optional[int] = None
thumbnail_height: Optional[int] = None
"""*Optional*. Thumbnail height"""

View file

@ -36,9 +36,9 @@ class InlineQueryResultContact(InlineQueryResult):
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[InputMessageContent] = None
"""*Optional*. Content of the message to be sent instead of the contact"""
thumb_url: Optional[str] = None
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
thumb_width: Optional[int] = None
thumbnail_width: Optional[int] = None
"""*Optional*. Thumbnail width"""
thumb_height: Optional[int] = None
thumbnail_height: Optional[int] = None
"""*Optional*. Thumbnail height"""

View file

@ -44,9 +44,9 @@ class InlineQueryResultDocument(InlineQueryResult):
"""*Optional*. Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None
"""*Optional*. Content of the message to be sent instead of the file"""
thumb_url: Optional[str] = None
thumbnail_url: Optional[str] = None
"""*Optional*. URL of the thumbnail (JPEG only) for the file"""
thumb_width: Optional[int] = None
thumbnail_width: Optional[int] = None
"""*Optional*. Thumbnail width"""
thumb_height: Optional[int] = None
thumbnail_height: Optional[int] = None
"""*Optional*. Thumbnail height"""

View file

@ -27,7 +27,7 @@ class InlineQueryResultGif(InlineQueryResult):
"""Unique identifier for this result, 1-64 bytes"""
gif_url: str
"""A valid URL for the GIF file. File size must not exceed 1MB"""
thumb_url: str
thumbnail_url: str
"""URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
gif_width: Optional[int] = None
"""*Optional*. Width of the GIF"""
@ -35,7 +35,7 @@ class InlineQueryResultGif(InlineQueryResult):
"""*Optional*. Height of the GIF"""
gif_duration: Optional[int] = None
"""*Optional*. Duration of the GIF in seconds"""
thumb_mime_type: Optional[str] = None
thumbnail_mime_type: Optional[str] = None
"""*Optional*. MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'"""
title: Optional[str] = None
"""*Optional*. Title for the result"""

View file

@ -42,9 +42,9 @@ class InlineQueryResultLocation(InlineQueryResult):
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[InputMessageContent] = None
"""*Optional*. Content of the message to be sent instead of the location"""
thumb_url: Optional[str] = None
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
thumb_width: Optional[int] = None
thumbnail_width: Optional[int] = None
"""*Optional*. Thumbnail width"""
thumb_height: Optional[int] = None
thumbnail_height: Optional[int] = None
"""*Optional*. Thumbnail height"""

View file

@ -27,7 +27,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
"""Unique identifier for this result, 1-64 bytes"""
mpeg4_url: str
"""A valid URL for the MPEG4 file. File size must not exceed 1MB"""
thumb_url: str
thumbnail_url: str
"""URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
mpeg4_width: Optional[int] = None
"""*Optional*. Video width"""
@ -35,7 +35,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
"""*Optional*. Video height"""
mpeg4_duration: Optional[int] = None
"""*Optional*. Video duration in seconds"""
thumb_mime_type: Optional[str] = None
thumbnail_mime_type: Optional[str] = None
"""*Optional*. MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'"""
title: Optional[str] = None
"""*Optional*. Title for the result"""

View file

@ -27,7 +27,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
"""Unique identifier for this result, 1-64 bytes"""
photo_url: str
"""A valid URL of the photo. Photo must be in **JPEG** format. Photo size must not exceed 5MB"""
thumb_url: str
thumbnail_url: str
"""URL of the thumbnail for the photo"""
photo_width: Optional[int] = None
"""*Optional*. Width of the photo"""

View file

@ -44,9 +44,9 @@ class InlineQueryResultVenue(InlineQueryResult):
"""*Optional*. `Inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ attached to the message"""
input_message_content: Optional[InputMessageContent] = None
"""*Optional*. Content of the message to be sent instead of the venue"""
thumb_url: Optional[str] = None
thumbnail_url: Optional[str] = None
"""*Optional*. Url of the thumbnail for the result"""
thumb_width: Optional[int] = None
thumbnail_width: Optional[int] = None
"""*Optional*. Thumbnail width"""
thumb_height: Optional[int] = None
thumbnail_height: Optional[int] = None
"""*Optional*. Thumbnail height"""

View file

@ -31,7 +31,7 @@ class InlineQueryResultVideo(InlineQueryResult):
"""A valid URL for the embedded video player or video file"""
mime_type: str
"""MIME type of the content of the video URL, 'text/html' or 'video/mp4'"""
thumb_url: str
thumbnail_url: str
"""URL of the thumbnail (JPEG only) for the video"""
title: str
"""Title for the result"""

View file

@ -24,7 +24,7 @@ class InputMediaAnimation(InputMedia):
"""Type of the result, must be *animation*"""
media: Union[str, InputFile]
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""*Optional*. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""*Optional*. Caption of the animation to be sent, 0-1024 characters after entities parsing"""

View file

@ -24,7 +24,7 @@ class InputMediaAudio(InputMedia):
"""Type of the result, must be *audio*"""
media: Union[str, InputFile]
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""*Optional*. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""*Optional*. Caption of the audio to be sent, 0-1024 characters after entities parsing"""

View file

@ -24,7 +24,7 @@ class InputMediaDocument(InputMedia):
"""Type of the result, must be *document*"""
media: Union[str, InputFile]
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""*Optional*. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""*Optional*. Caption of the document to be sent, 0-1024 characters after entities parsing"""

View file

@ -24,7 +24,7 @@ class InputMediaVideo(InputMedia):
"""Type of the result, must be *video*"""
media: Union[str, InputFile]
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
thumb: Optional[Union[InputFile, str]] = None
thumbnail: Optional[Union[InputFile, str]] = None
"""*Optional*. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""*Optional*. Caption of the video to be sent, 0-1024 characters after entities parsing"""

View file

@ -0,0 +1,26 @@
from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union
from .base import TelegramObject
if TYPE_CHECKING:
from .input_file import InputFile
from .mask_position import MaskPosition
class InputSticker(TelegramObject):
"""
This object describes a sticker to be added to a sticker set.
Source: https://core.telegram.org/bots/api#inputsticker
"""
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, or upload a new one using multipart/form-data. Animated and video stickers can't be uploaded via HTTP URL. :ref:`More information on Sending Files » <sending-files>`"""
emoji_list: List[str]
"""List of 1-20 emoji associated with the sticker"""
mask_position: Optional[MaskPosition] = None
"""*Optional*. Position where the mask should be placed on faces. For 'mask' stickers only."""
keywords: Optional[List[str]] = None
"""*Optional*. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For 'regular' and 'custom_emoji' stickers only."""

View file

@ -348,7 +348,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -377,7 +377,7 @@ class Message(TelegramObject):
:param duration: Duration of sent animation in seconds
:param width: Animation width
:param height: Animation height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -401,7 +401,7 @@ class Message(TelegramObject):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -419,7 +419,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -448,7 +448,7 @@ class Message(TelegramObject):
:param duration: Duration of sent animation in seconds
:param width: Animation width
:param height: Animation height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -472,7 +472,7 @@ class Message(TelegramObject):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -494,7 +494,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
performer: Optional[str] = None,
title: Optional[str] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -523,7 +523,7 @@ class Message(TelegramObject):
:param duration: Duration of the audio in seconds
:param performer: Performer
:param title: Track name
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
@ -546,7 +546,7 @@ class Message(TelegramObject):
duration=duration,
performer=performer,
title=title,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
allow_sending_without_reply=allow_sending_without_reply,
@ -563,7 +563,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
performer: Optional[str] = None,
title: Optional[str] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -592,7 +592,7 @@ class Message(TelegramObject):
:param duration: Duration of the audio in seconds
:param performer: Performer
:param title: Track name
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -615,7 +615,7 @@ class Message(TelegramObject):
duration=duration,
performer=performer,
title=title,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
@ -740,7 +740,7 @@ class Message(TelegramObject):
def reply_document(
self,
document: Union[InputFile, str],
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -766,7 +766,7 @@ class Message(TelegramObject):
Source: https://core.telegram.org/bots/api#senddocument
:param document: 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>`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -787,7 +787,7 @@ class Message(TelegramObject):
message_thread_id=self.message_thread_id if self.is_topic_message else None,
reply_to_message_id=self.message_id,
document=document,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -802,7 +802,7 @@ class Message(TelegramObject):
def answer_document(
self,
document: Union[InputFile, str],
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -828,7 +828,7 @@ class Message(TelegramObject):
Source: https://core.telegram.org/bots/api#senddocument
:param document: 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>`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -849,7 +849,7 @@ class Message(TelegramObject):
chat_id=self.chat.id,
message_thread_id=self.message_thread_id if self.is_topic_message else None,
document=document,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -1865,6 +1865,7 @@ class Message(TelegramObject):
def reply_sticker(
self,
sticker: Union[InputFile, str],
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -1885,7 +1886,8 @@ class Message(TelegramObject):
Source: https://core.telegram.org/bots/api#sendsticker
:param sticker: 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`
:param sticker: 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.
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
@ -1902,6 +1904,7 @@ class Message(TelegramObject):
message_thread_id=self.message_thread_id if self.is_topic_message else None,
reply_to_message_id=self.message_id,
sticker=sticker,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
allow_sending_without_reply=allow_sending_without_reply,
@ -1912,6 +1915,7 @@ class Message(TelegramObject):
def answer_sticker(
self,
sticker: Union[InputFile, str],
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -1932,7 +1936,8 @@ class Message(TelegramObject):
Source: https://core.telegram.org/bots/api#sendsticker
:param sticker: 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`
:param sticker: 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.
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -1949,6 +1954,7 @@ class Message(TelegramObject):
chat_id=self.chat.id,
message_thread_id=self.message_thread_id if self.is_topic_message else None,
sticker=sticker,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
@ -2100,7 +2106,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -2130,7 +2136,7 @@ class Message(TelegramObject):
:param duration: Duration of sent video in seconds
:param width: Video width
:param height: Video height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -2155,7 +2161,7 @@ class Message(TelegramObject):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -2174,7 +2180,7 @@ class Message(TelegramObject):
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
@ -2204,7 +2210,7 @@ class Message(TelegramObject):
:param duration: Duration of sent video in seconds
:param width: Video width
:param height: Video height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@ -2229,7 +2235,7 @@ class Message(TelegramObject):
duration=duration,
width=width,
height=height,
thumb=thumb,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -2248,7 +2254,7 @@ class Message(TelegramObject):
video_note: Union[InputFile, str],
duration: Optional[int] = None,
length: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -2272,7 +2278,7 @@ class Message(TelegramObject):
:param video_note: 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
:param duration: Duration of sent video in seconds
:param length: Video width and height, i.e. diameter of the video message
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
@ -2291,7 +2297,7 @@ class Message(TelegramObject):
video_note=video_note,
duration=duration,
length=length,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
allow_sending_without_reply=allow_sending_without_reply,
@ -2304,7 +2310,7 @@ class Message(TelegramObject):
video_note: Union[InputFile, str],
duration: Optional[int] = None,
length: Optional[int] = None,
thumb: Optional[Union[InputFile, str]] = None,
thumbnail: Optional[Union[InputFile, str]] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@ -2328,7 +2334,7 @@ class Message(TelegramObject):
:param video_note: 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
:param duration: Duration of sent video in seconds
:param length: Video width and height, i.e. diameter of the video message
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the sent message from forwarding and saving
:param reply_to_message_id: If the message is a reply, ID of the original message
@ -2347,7 +2353,7 @@ class Message(TelegramObject):
video_note=video_note,
duration=duration,
length=length,
thumb=thumb,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,

View file

@ -32,7 +32,7 @@ class Sticker(TelegramObject):
""":code:`True`, if the sticker is `animated <https://telegram.org/blog/animated-stickers>`_"""
is_video: bool
""":code:`True`, if the sticker is a `video sticker <https://telegram.org/blog/video-stickers-better-reactions>`_"""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Sticker thumbnail in the .WEBP or .JPG format"""
emoji: Optional[str] = None
"""*Optional*. Emoji associated with the sticker"""
@ -44,6 +44,8 @@ class Sticker(TelegramObject):
"""*Optional*. For mask stickers, the position where the mask should be placed"""
custom_emoji_id: Optional[str] = None
"""*Optional*. For custom emoji stickers, unique identifier of the custom emoji"""
needs_repainting: Optional[bool] = None
"""*Optional*. :code:`True`, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places"""
file_size: Optional[int] = None
"""*Optional*. File size in bytes"""

View file

@ -28,5 +28,5 @@ class StickerSet(TelegramObject):
""":code:`True`, if the sticker set contains `video stickers <https://telegram.org/blog/video-stickers-better-reactions>`_"""
stickers: List[Sticker]
"""List of all set stickers"""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format"""

View file

@ -25,7 +25,7 @@ class Video(TelegramObject):
"""Video height as defined by sender"""
duration: int
"""Duration of the video in seconds as defined by sender"""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Video thumbnail"""
file_name: Optional[str] = None
"""*Optional*. Original filename as defined by sender"""

View file

@ -23,7 +23,7 @@ class VideoNote(TelegramObject):
"""Video width and height (diameter of the video message) as defined by sender"""
duration: int
"""Duration of the video in seconds as defined by sender"""
thumb: Optional[PhotoSize] = None
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Video thumbnail"""
file_size: Optional[int] = None
"""*Optional*. File size in bytes"""