mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support for the Bot API 8.3 (#1638)
* Added full support for the Bot API 8.3 * Added changelog * Ignore typing for aiohttp_socks
This commit is contained in:
parent
25833b830e
commit
d8b9ce1be9
65 changed files with 660 additions and 118 deletions
|
|
@ -1,2 +1,2 @@
|
|||
__version__ = "3.17.0"
|
||||
__api_version__ = "8.2"
|
||||
__version__ = "3.18.0"
|
||||
__api_version__ = "8.3"
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ class Bot:
|
|||
:param shipping_query_id: Unique identifier for the query to be answered
|
||||
:param ok: Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)
|
||||
:param shipping_options: Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options.
|
||||
:param error_message: Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:param error_message: Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, :code:`True` is returned.
|
||||
"""
|
||||
|
|
@ -861,6 +861,7 @@ class Bot:
|
|||
from_chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -887,6 +888,7 @@ class Bot:
|
|||
:param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)
|
||||
:param message_id: Message identifier in the chat specified in *from_chat_id*
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:param video_start_timestamp: New start timestamp for the copied video in the message
|
||||
:param caption: New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
|
||||
:param parse_mode: Mode for parsing entities in the new 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 new caption, which can be specified instead of *parse_mode*
|
||||
|
|
@ -907,6 +909,7 @@ class Bot:
|
|||
from_chat_id=from_chat_id,
|
||||
message_id=message_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -1615,6 +1618,7 @@ class Bot:
|
|||
from_chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||
request_timeout: Optional[int] = None,
|
||||
|
|
@ -1628,6 +1632,7 @@ class Bot:
|
|||
:param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)
|
||||
:param message_id: Message identifier in the chat specified in *from_chat_id*
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:param video_start_timestamp: New start timestamp for the forwarded video in the message
|
||||
: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 forwarded message from forwarding and saving
|
||||
:param request_timeout: Request timeout
|
||||
|
|
@ -1639,6 +1644,7 @@ class Bot:
|
|||
from_chat_id=from_chat_id,
|
||||
message_id=message_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
|
@ -3275,6 +3281,8 @@ class Bot:
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -3308,6 +3316,8 @@ class Bot:
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -3335,6 +3345,8 @@ class Bot:
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -4607,7 +4619,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmessagereaction
|
||||
|
||||
|
|
@ -4869,7 +4881,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Gifts:
|
||||
"""
|
||||
Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
|
||||
Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getavailablegifts
|
||||
|
||||
|
|
@ -4938,8 +4950,9 @@ class Bot:
|
|||
|
||||
async def send_gift(
|
||||
self,
|
||||
user_id: int,
|
||||
gift_id: str,
|
||||
user_id: Optional[int] = None,
|
||||
chat_id: Optional[Union[int, str]] = None,
|
||||
pay_for_upgrade: Optional[bool] = None,
|
||||
text: Optional[str] = None,
|
||||
text_parse_mode: Optional[str] = None,
|
||||
|
|
@ -4947,12 +4960,13 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.
|
||||
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendgift
|
||||
|
||||
:param user_id: Unique identifier of the target user that will receive the gift
|
||||
:param gift_id: Identifier of the gift
|
||||
:param user_id: Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift.
|
||||
:param chat_id: Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift.
|
||||
:param pay_for_upgrade: Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
|
||||
:param text: Text that will be shown along with the gift; 0-255 characters
|
||||
:param text_parse_mode: Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
|
||||
|
|
@ -4962,8 +4976,9 @@ class Bot:
|
|||
"""
|
||||
|
||||
call = SendGift(
|
||||
user_id=user_id,
|
||||
gift_id=gift_id,
|
||||
user_id=user_id,
|
||||
chat_id=chat_id,
|
||||
pay_for_upgrade=pay_for_upgrade,
|
||||
text=text,
|
||||
text_parse_mode=text_parse_mode,
|
||||
|
|
@ -5005,7 +5020,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
Removes verification from a chat that is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removechatverification
|
||||
|
||||
|
|
@ -5025,7 +5040,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
Removes verification from a user who is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removeuserverification
|
||||
|
||||
|
|
@ -5046,7 +5061,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
Verifies a chat `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifychat
|
||||
|
||||
|
|
@ -5069,7 +5084,7 @@ class Bot:
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
Verifies a user `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifyuser
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ _ProxyType = Union[_ProxyChain, _ProxyBasic]
|
|||
|
||||
|
||||
def _retrieve_basic(basic: _ProxyBasic) -> Dict[str, Any]:
|
||||
from aiohttp_socks.utils import parse_proxy_url # type: ignore
|
||||
from aiohttp_socks.utils import parse_proxy_url
|
||||
|
||||
proxy_auth: Optional[BasicAuth] = None
|
||||
|
||||
|
|
@ -63,11 +63,7 @@ def _retrieve_basic(basic: _ProxyBasic) -> Dict[str, Any]:
|
|||
|
||||
|
||||
def _prepare_connector(chain_or_plain: _ProxyType) -> Tuple[Type["TCPConnector"], Dict[str, Any]]:
|
||||
from aiohttp_socks import ( # type: ignore
|
||||
ChainProxyConnector,
|
||||
ProxyConnector,
|
||||
ProxyInfo,
|
||||
)
|
||||
from aiohttp_socks import ChainProxyConnector, ProxyConnector, ProxyInfo
|
||||
|
||||
# since tuple is Iterable(compatible with _ProxyChain) object, we assume that
|
||||
# user wants chained proxies if tuple is a pair of string(url) and BasicAuth
|
||||
|
|
|
|||
|
|
@ -14,3 +14,4 @@ class TransactionPartnerType(str, Enum):
|
|||
TELEGRAM_ADS = "telegram_ads"
|
||||
TELEGRAM_API = "telegram_api"
|
||||
AFFILIATE_PROGRAM = "affiliate_program"
|
||||
CHAT = "chat"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AnswerShippingQuery(TelegramMethod[bool]):
|
|||
shipping_options: Optional[list[ShippingOption]] = None
|
||||
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
|
||||
error_message: Optional[str] = None
|
||||
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
|
||||
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from pydantic import Field
|
||||
|
|
@ -35,6 +36,8 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
"""Message identifier in the chat specified in *from_chat_id*"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""New start timestamp for the copied video in the message"""
|
||||
caption: Optional[str] = None
|
||||
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||
|
|
@ -79,6 +82,9 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
from_chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[
|
||||
Union[datetime.datetime, datetime.timedelta, int]
|
||||
] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -105,6 +111,7 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
from_chat_id=from_chat_id,
|
||||
message_id=message_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from ..client.default import Default
|
||||
|
|
@ -25,6 +26,8 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
"""Message identifier in the chat specified in *from_chat_id*"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""New start timestamp for the forwarded video in the message"""
|
||||
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[Union[bool, Default]] = Default("protect_content")
|
||||
|
|
@ -41,6 +44,9 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
from_chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[
|
||||
Union[datetime.datetime, datetime.timedelta, int]
|
||||
] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||
**__pydantic_kwargs: Any,
|
||||
|
|
@ -54,6 +60,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
from_chat_id=from_chat_id,
|
||||
message_id=message_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
**__pydantic_kwargs,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from .base import TelegramMethod
|
|||
|
||||
class GetAvailableGifts(TelegramMethod[Gifts]):
|
||||
"""
|
||||
Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
|
||||
Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getavailablegifts
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
class RemoveChatVerification(TelegramMethod[bool]):
|
||||
"""
|
||||
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
Removes verification from a chat that is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removechatverification
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
class RemoveUserVerification(TelegramMethod[bool]):
|
||||
"""
|
||||
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.
|
||||
Removes verification from a user who is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removeuserverification
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from ..types.message_entity import MessageEntity
|
||||
from .base import TelegramMethod
|
||||
|
|
@ -8,7 +8,7 @@ from .base import TelegramMethod
|
|||
|
||||
class SendGift(TelegramMethod[bool]):
|
||||
"""
|
||||
Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.
|
||||
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendgift
|
||||
"""
|
||||
|
|
@ -16,10 +16,12 @@ class SendGift(TelegramMethod[bool]):
|
|||
__returning__ = bool
|
||||
__api_method__ = "sendGift"
|
||||
|
||||
user_id: int
|
||||
"""Unique identifier of the target user that will receive the gift"""
|
||||
gift_id: str
|
||||
"""Identifier of the gift"""
|
||||
user_id: Optional[int] = None
|
||||
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
|
||||
chat_id: Optional[Union[int, str]] = None
|
||||
"""Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift."""
|
||||
pay_for_upgrade: Optional[bool] = None
|
||||
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
|
||||
text: Optional[str] = None
|
||||
|
|
@ -36,8 +38,9 @@ class SendGift(TelegramMethod[bool]):
|
|||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
user_id: int,
|
||||
gift_id: str,
|
||||
user_id: Optional[int] = None,
|
||||
chat_id: Optional[Union[int, str]] = None,
|
||||
pay_for_upgrade: Optional[bool] = None,
|
||||
text: Optional[str] = None,
|
||||
text_parse_mode: Optional[str] = None,
|
||||
|
|
@ -49,8 +52,9 @@ class SendGift(TelegramMethod[bool]):
|
|||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
user_id=user_id,
|
||||
gift_id=gift_id,
|
||||
user_id=user_id,
|
||||
chat_id=chat_id,
|
||||
pay_for_upgrade=pay_for_upgrade,
|
||||
text=text,
|
||||
text_parse_mode=text_parse_mode,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from pydantic import Field
|
||||
|
|
@ -44,6 +45,10 @@ class SendVideo(TelegramMethod[Message]):
|
|||
"""Video height"""
|
||||
thumbnail: Optional[InputFile] = 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>`"""
|
||||
cover: Optional[Union[InputFile, str]] = None
|
||||
"""Cover for the video in the message. 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>`"""
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""Start timestamp for the video in the message"""
|
||||
caption: Optional[str] = None
|
||||
"""Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||
|
|
@ -98,6 +103,8 @@ class SendVideo(TelegramMethod[Message]):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -131,6 +138,8 @@ class SendVideo(TelegramMethod[Message]):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from .base import TelegramMethod
|
|||
|
||||
class SetMessageReaction(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmessagereaction
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
class VerifyChat(TelegramMethod[bool]):
|
||||
"""
|
||||
Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
Verifies a chat `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifychat
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
class VerifyUser(TelegramMethod[bool]):
|
||||
"""
|
||||
Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.
|
||||
Verifies a user `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ which is represented by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#verifyuser
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
|
|||
from .text_quote import TextQuote
|
||||
from .transaction_partner import TransactionPartner
|
||||
from .transaction_partner_affiliate_program import TransactionPartnerAffiliateProgram
|
||||
from .transaction_partner_chat import TransactionPartnerChat
|
||||
from .transaction_partner_fragment import TransactionPartnerFragment
|
||||
from .transaction_partner_other import TransactionPartnerOther
|
||||
from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
|
||||
|
|
@ -460,6 +461,7 @@ __all__ = (
|
|||
"TextQuote",
|
||||
"TransactionPartner",
|
||||
"TransactionPartnerAffiliateProgram",
|
||||
"TransactionPartnerChat",
|
||||
"TransactionPartnerFragment",
|
||||
"TransactionPartnerOther",
|
||||
"TransactionPartnerTelegramAds",
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ class ChatFullInfo(Chat):
|
|||
"""*Optional*. The most recent pinned message (by sending date)"""
|
||||
permissions: Optional[ChatPermissions] = None
|
||||
"""*Optional*. Default chat member permissions, for groups and supergroups"""
|
||||
can_send_gift: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if gifts can be sent to the chat"""
|
||||
can_send_paid_media: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats."""
|
||||
slow_mode_delay: Optional[int] = None
|
||||
|
|
@ -157,6 +159,7 @@ class ChatFullInfo(Chat):
|
|||
invite_link: Optional[str] = None,
|
||||
pinned_message: Optional[Message] = None,
|
||||
permissions: Optional[ChatPermissions] = None,
|
||||
can_send_gift: Optional[bool] = None,
|
||||
can_send_paid_media: Optional[bool] = None,
|
||||
slow_mode_delay: Optional[int] = None,
|
||||
unrestrict_boost_count: Optional[int] = None,
|
||||
|
|
@ -208,6 +211,7 @@ class ChatFullInfo(Chat):
|
|||
invite_link=invite_link,
|
||||
pinned_message=pinned_message,
|
||||
permissions=permissions,
|
||||
can_send_gift=can_send_gift,
|
||||
can_send_paid_media=can_send_paid_media,
|
||||
slow_mode_delay=slow_mode_delay,
|
||||
unrestrict_boost_count=unrestrict_boost_count,
|
||||
|
|
|
|||
|
|
@ -2340,6 +2340,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -2377,6 +2379,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -2407,6 +2411,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -2433,6 +2439,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -2470,6 +2478,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -2500,6 +2510,8 @@ class ChatJoinRequest(TelegramObject):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,8 @@ class ChatMemberUpdated(TelegramObject):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -1273,6 +1275,8 @@ class ChatMemberUpdated(TelegramObject):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -1303,6 +1307,8 @@ class ChatMemberUpdated(TelegramObject):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -2320,6 +2320,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -2357,6 +2359,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -2391,6 +2395,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -2417,6 +2423,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -2453,6 +2461,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -2486,6 +2496,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
|
||||
|
||||
from ..client.default import Default
|
||||
|
|
@ -24,6 +25,10 @@ class InputMediaVideo(InputMedia):
|
|||
"""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>`"""
|
||||
thumbnail: Optional[InputFile] = 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>`"""
|
||||
cover: Optional[Union[str, InputFile]] = None
|
||||
"""*Optional*. Cover for the video in the message. 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>`"""
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""*Optional*. Start timestamp for the video in the message"""
|
||||
caption: Optional[str] = None
|
||||
"""*Optional*. Caption of the video to be sent, 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||
|
|
@ -53,6 +58,8 @@ class InputMediaVideo(InputMedia):
|
|||
type: Literal[InputMediaType.VIDEO] = InputMediaType.VIDEO,
|
||||
media: Union[str, InputFile],
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[str, InputFile]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -74,6 +81,8 @@ class InputMediaVideo(InputMedia):
|
|||
type=type,
|
||||
media=media,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
|
||||
|
||||
from ..enums import InputPaidMediaType
|
||||
|
|
@ -18,8 +19,12 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|||
"""Type of the media, 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>`"""
|
||||
thumbnail: Optional[Union[InputFile, str]] = None
|
||||
thumbnail: Optional[InputFile] = 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>`"""
|
||||
cover: Optional[Union[str, InputFile]] = None
|
||||
"""*Optional*. Cover for the video in the message. 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>`"""
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""*Optional*. Start timestamp for the video in the message"""
|
||||
width: Optional[int] = None
|
||||
"""*Optional*. Video width"""
|
||||
height: Optional[int] = None
|
||||
|
|
@ -38,7 +43,9 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|||
*,
|
||||
type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO,
|
||||
media: Union[str, InputFile],
|
||||
thumbnail: Optional[Union[InputFile, str]] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[str, InputFile]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
duration: Optional[int] = None,
|
||||
|
|
@ -53,6 +60,8 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|||
type=type,
|
||||
media=media,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
width=width,
|
||||
height=height,
|
||||
duration=duration,
|
||||
|
|
|
|||
|
|
@ -2885,6 +2885,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -2921,6 +2923,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -2954,6 +2958,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -2976,6 +2982,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
thumbnail: Optional[InputFile] = None,
|
||||
cover: Optional[Union[InputFile, str]] = None,
|
||||
start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -3013,6 +3021,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
:param width: Video width
|
||||
:param height: Video height
|
||||
: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 cover: Cover for the video in the message. 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>`
|
||||
:param start_timestamp: Start timestamp for the video in the message
|
||||
: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*
|
||||
|
|
@ -3047,6 +3057,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
width=width,
|
||||
height=height,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -3551,6 +3563,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||
caption_entities: Optional[list[MessageEntity]] = None,
|
||||
|
|
@ -3581,6 +3594,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:param video_start_timestamp: New start timestamp for the copied video in the message
|
||||
:param caption: New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
|
||||
:param parse_mode: Mode for parsing entities in the new 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 new caption, which can be specified instead of *parse_mode*
|
||||
|
|
@ -3608,6 +3622,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
message_id=self.message_id,
|
||||
chat_id=chat_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
@ -3685,6 +3700,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
message_thread_id: Optional[int] = None,
|
||||
video_start_timestamp: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||
**kwargs: Any,
|
||||
|
|
@ -3702,6 +3718,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:param video_start_timestamp: New start timestamp for the forwarded video in the message
|
||||
: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 forwarded message from forwarding and saving
|
||||
:return: instance of method :class:`aiogram.methods.forward_message.ForwardMessage`
|
||||
|
|
@ -3720,6 +3737,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
message_id=self.message_id,
|
||||
chat_id=chat_id,
|
||||
message_thread_id=message_thread_id,
|
||||
video_start_timestamp=video_start_timestamp,
|
||||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
**kwargs,
|
||||
|
|
@ -4173,7 +4191,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
- :code:`message_id`
|
||||
- :code:`business_connection_id`
|
||||
|
||||
Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmessagereaction
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class ShippingQuery(TelegramObject):
|
|||
|
||||
:param ok: Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)
|
||||
:param shipping_options: Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options.
|
||||
:param error_message: Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:param error_message: Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:return: instance of method :class:`aiogram.methods.answer_shipping_query.AnswerShippingQuery`
|
||||
"""
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ if TYPE_CHECKING:
|
|||
from .transaction_partner_affiliate_program import (
|
||||
TransactionPartnerAffiliateProgram,
|
||||
)
|
||||
from .transaction_partner_chat import TransactionPartnerChat
|
||||
from .transaction_partner_fragment import TransactionPartnerFragment
|
||||
from .transaction_partner_other import TransactionPartnerOther
|
||||
from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
|
||||
|
|
@ -18,7 +19,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class StarTransaction(TelegramObject):
|
||||
"""
|
||||
Describes a Telegram Star transaction.
|
||||
Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#startransaction
|
||||
"""
|
||||
|
|
@ -34,6 +35,7 @@ class StarTransaction(TelegramObject):
|
|||
source: Optional[
|
||||
Union[
|
||||
TransactionPartnerUser,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerTelegramAds,
|
||||
|
|
@ -45,6 +47,7 @@ class StarTransaction(TelegramObject):
|
|||
receiver: Optional[
|
||||
Union[
|
||||
TransactionPartnerUser,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerTelegramAds,
|
||||
|
|
@ -68,6 +71,7 @@ class StarTransaction(TelegramObject):
|
|||
source: Optional[
|
||||
Union[
|
||||
TransactionPartnerUser,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerTelegramAds,
|
||||
|
|
@ -78,6 +82,7 @@ class StarTransaction(TelegramObject):
|
|||
receiver: Optional[
|
||||
Union[
|
||||
TransactionPartnerUser,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerTelegramAds,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class SuccessfulPayment(TelegramObject):
|
||||
"""
|
||||
This object contains basic information about a successful payment.
|
||||
This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#successfulpayment
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class TransactionPartner(TelegramObject):
|
|||
This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
|
||||
|
||||
- :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`
|
||||
- :class:`aiogram.types.transaction_partner_chat.TransactionPartnerChat`
|
||||
- :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram`
|
||||
- :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`
|
||||
- :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`
|
||||
|
|
|
|||
43
aiogram/types/transaction_partner_chat.py
Normal file
43
aiogram/types/transaction_partner_chat.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional
|
||||
|
||||
from ..enums import TransactionPartnerType
|
||||
from .transaction_partner import TransactionPartner
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .chat import Chat
|
||||
from .gift import Gift
|
||||
|
||||
|
||||
class TransactionPartnerChat(TransactionPartner):
|
||||
"""
|
||||
Describes a transaction with a chat.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#transactionpartnerchat
|
||||
"""
|
||||
|
||||
type: Literal[TransactionPartnerType.CHAT] = TransactionPartnerType.CHAT
|
||||
"""Type of the transaction partner, always 'chat'"""
|
||||
chat: Chat
|
||||
"""Information about the chat"""
|
||||
gift: Optional[Gift] = None
|
||||
"""*Optional*. The gift sent to the chat by the bot"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
type: Literal[TransactionPartnerType.CHAT] = TransactionPartnerType.CHAT,
|
||||
chat: Chat,
|
||||
gift: Optional[Gift] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(type=type, chat=chat, gift=gift, **__pydantic_kwargs)
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from .base import TelegramObject
|
||||
|
|
@ -27,6 +28,10 @@ class Video(TelegramObject):
|
|||
"""Duration of the video in seconds as defined by the sender"""
|
||||
thumbnail: Optional[PhotoSize] = None
|
||||
"""*Optional*. Video thumbnail"""
|
||||
cover: Optional[list[PhotoSize]] = None
|
||||
"""*Optional*. Available sizes of the cover of the video in the message"""
|
||||
start_timestamp: Optional[datetime.datetime] = None
|
||||
"""*Optional*. Timestamp in seconds from which the video will play in the message"""
|
||||
file_name: Optional[str] = None
|
||||
"""*Optional*. Original filename as defined by the sender"""
|
||||
mime_type: Optional[str] = None
|
||||
|
|
@ -47,6 +52,8 @@ class Video(TelegramObject):
|
|||
height: int,
|
||||
duration: int,
|
||||
thumbnail: Optional[PhotoSize] = None,
|
||||
cover: Optional[list[PhotoSize]] = None,
|
||||
start_timestamp: Optional[datetime.datetime] = None,
|
||||
file_name: Optional[str] = None,
|
||||
mime_type: Optional[str] = None,
|
||||
file_size: Optional[int] = None,
|
||||
|
|
@ -63,6 +70,8 @@ class Video(TelegramObject):
|
|||
height=height,
|
||||
duration=duration,
|
||||
thumbnail=thumbnail,
|
||||
cover=cover,
|
||||
start_timestamp=start_timestamp,
|
||||
file_name=file_name,
|
||||
mime_type=mime_type,
|
||||
file_size=file_size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue