Added full support for the Bot API 9.2 (#1720)

* Added full support for the Bot API 9.2

* Mark butcher tool output files as linguist-generated in .gitattributes

* Switch `send_date` type from `int` to `DateTime` in suggested post models
This commit is contained in:
Alex Root Junior 2025-08-17 19:07:58 +03:00 committed by GitHub
parent ddcedadfbd
commit ab8af773cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
165 changed files with 4404 additions and 813 deletions

View file

@ -5,6 +5,7 @@ from .answer_pre_checkout_query import AnswerPreCheckoutQuery
from .answer_shipping_query import AnswerShippingQuery
from .answer_web_app_query import AnswerWebAppQuery
from .approve_chat_join_request import ApproveChatJoinRequest
from .approve_suggested_post import ApproveSuggestedPost
from .ban_chat_member import BanChatMember
from .ban_chat_sender_chat import BanChatSenderChat
from .base import Request, Response, TelegramMethod
@ -20,6 +21,7 @@ from .create_forum_topic import CreateForumTopic
from .create_invoice_link import CreateInvoiceLink
from .create_new_sticker_set import CreateNewStickerSet
from .decline_chat_join_request import DeclineChatJoinRequest
from .decline_suggested_post import DeclineSuggestedPost
from .delete_business_messages import DeleteBusinessMessages
from .delete_chat_photo import DeleteChatPhoto
from .delete_chat_sticker_set import DeleteChatStickerSet
@ -164,6 +166,7 @@ __all__ = (
"AnswerShippingQuery",
"AnswerWebAppQuery",
"ApproveChatJoinRequest",
"ApproveSuggestedPost",
"BanChatMember",
"BanChatSenderChat",
"Close",
@ -178,6 +181,7 @@ __all__ = (
"CreateInvoiceLink",
"CreateNewStickerSet",
"DeclineChatJoinRequest",
"DeclineSuggestedPost",
"DeleteBusinessMessages",
"DeleteChatPhoto",
"DeleteChatStickerSet",

View file

@ -0,0 +1,44 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import DateTimeUnion
from .base import TelegramMethod
class ApproveSuggestedPost(TelegramMethod[bool]):
"""
Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#approvesuggestedpost
"""
__returning__ = bool
__api_method__ = "approveSuggestedPost"
chat_id: int
"""Unique identifier for the target direct messages chat"""
message_id: int
"""Identifier of a suggested post message to approve"""
send_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: int,
message_id: int,
send_date: Optional[DateTimeUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id, message_id=message_id, send_date=send_date, **__pydantic_kwargs
)

View file

@ -12,6 +12,7 @@ from ..types import (
MessageId,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -34,6 +35,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"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
video_start_timestamp: Optional[DateTimeUnion] = None
"""New start timestamp for the copied video in the message"""
caption: Optional[str] = None
@ -50,6 +53,8 @@ class CopyMessage(TelegramMethod[MessageId]):
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -78,6 +83,7 @@ class CopyMessage(TelegramMethod[MessageId]):
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -88,6 +94,7 @@ class CopyMessage(TelegramMethod[MessageId]):
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -103,6 +110,7 @@ class CopyMessage(TelegramMethod[MessageId]):
from_chat_id=from_chat_id,
message_id=message_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
video_start_timestamp=video_start_timestamp,
caption=caption,
parse_mode=parse_mode,
@ -111,6 +119,7 @@ class CopyMessage(TelegramMethod[MessageId]):
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -22,6 +22,8 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
disable_notification: Optional[bool] = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
@ -40,6 +42,7 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
remove_caption: Optional[bool] = None,
@ -54,6 +57,7 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
from_chat_id=from_chat_id,
message_ids=message_ids,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
disable_notification=disable_notification,
protect_content=protect_content,
remove_caption=remove_caption,

View file

@ -0,0 +1,43 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class DeclineSuggestedPost(TelegramMethod[bool]):
"""
Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#declinesuggestedpost
"""
__returning__ = bool
__api_method__ = "declineSuggestedPost"
chat_id: int
"""Unique identifier for the target direct messages chat"""
message_id: int
"""Identifier of a suggested post message to decline"""
comment: Optional[str] = None
"""Comment for the creator of the suggested post; 0-128 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: int,
message_id: int,
comment: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id, message_id=message_id, comment=comment, **__pydantic_kwargs
)

View file

@ -24,7 +24,9 @@ class DeleteMessage(TelegramMethod[bool]):
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has *can_delete_messages* permission in a supergroup or a channel, it can delete any message there.
- If the bot has *can_delete_messages* administrator right in a supergroup or a channel, it can delete any message there.
- If the bot has *can_manage_direct_messages* administrator right in a channel, it can delete any message in the corresponding direct messages chat.
Returns :code:`True` on success.

View file

@ -3,7 +3,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import ChatIdUnion, DateTimeUnion, Message
from ..types import ChatIdUnion, DateTimeUnion, Message, SuggestedPostParameters
from .base import TelegramMethod
@ -25,12 +25,16 @@ 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"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat"""
video_start_timestamp: Optional[DateTimeUnion] = 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")
"""Protects the contents of the forwarded message from forwarding and saving"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -43,9 +47,11 @@ class ForwardMessage(TelegramMethod[Message]):
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -57,8 +63,10 @@ class ForwardMessage(TelegramMethod[Message]):
from_chat_id=from_chat_id,
message_id=message_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
video_start_timestamp=video_start_timestamp,
disable_notification=disable_notification,
protect_content=protect_content,
suggested_post_parameters=suggested_post_parameters,
**__pydantic_kwargs,
)

View file

@ -22,6 +22,8 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat"""
disable_notification: Optional[bool] = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
@ -38,6 +40,7 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
**__pydantic_kwargs: Any,
@ -51,6 +54,7 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
from_chat_id=from_chat_id,
message_ids=message_ids,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
disable_notification=disable_notification,
protect_content=protect_content,
**__pydantic_kwargs,

View file

@ -17,7 +17,7 @@ class LeaveChat(TelegramMethod[bool]):
__api_method__ = "leaveChat"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`). Channel direct messages chats aren't supported; leave the corresponding channel instead."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class PinChatMessage(TelegramMethod[bool]):
"""
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success.
Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#pinchatmessage
"""

View file

@ -50,6 +50,8 @@ class PromoteChatMember(TelegramMethod[bool]):
"""Pass :code:`True` if the administrator can pin messages; for supergroups only"""
can_manage_topics: Optional[bool] = None
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"""
can_manage_direct_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can manage direct messages within the channel and decline suggested posts; for channels only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -75,6 +77,7 @@ class PromoteChatMember(TelegramMethod[bool]):
can_edit_messages: Optional[bool] = None,
can_pin_messages: Optional[bool] = None,
can_manage_topics: Optional[bool] = None,
can_manage_direct_messages: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -99,5 +102,6 @@ class PromoteChatMember(TelegramMethod[bool]):
can_edit_messages=can_edit_messages,
can_pin_messages=can_pin_messages,
can_manage_topics=can_manage_topics,
can_manage_direct_messages=can_manage_direct_messages,
**__pydantic_kwargs,
)

View file

@ -13,6 +13,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -35,6 +36,8 @@ class SendAnimation(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None
"""Duration of sent animation in seconds"""
width: Optional[int] = None
@ -61,6 +64,8 @@ class SendAnimation(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -89,6 +94,7 @@ class SendAnimation(TelegramMethod[Message]):
animation: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
@ -104,6 +110,7 @@ class SendAnimation(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -119,6 +126,7 @@ class SendAnimation(TelegramMethod[Message]):
animation=animation,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
duration=duration,
width=width,
height=height,
@ -132,6 +140,7 @@ class SendAnimation(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -13,6 +13,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -36,6 +37,8 @@ class SendAudio(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None
"""Audio caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
@ -58,6 +61,8 @@ class SendAudio(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -86,6 +91,7 @@ class SendAudio(TelegramMethod[Message]):
audio: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
@ -97,6 +103,7 @@ class SendAudio(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -112,6 +119,7 @@ class SendAudio(TelegramMethod[Message]):
audio=audio,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -123,6 +131,7 @@ class SendAudio(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -21,7 +21,7 @@ class SendChatAction(TelegramMethod[bool]):
__api_method__ = "sendChatAction"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`). Channel chats and channel direct messages chats aren't supported."""
action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
business_connection_id: Optional[str] = None

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from ..types import (
ChatIdUnion,
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -29,6 +35,8 @@ class SendContact(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
last_name: Optional[str] = None
"""Contact's last name"""
vcard: Optional[str] = None
@ -41,6 +49,8 @@ class SendContact(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -70,12 +80,14 @@ class SendContact(TelegramMethod[Message]):
first_name: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
last_name: Optional[str] = None,
vcard: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -92,12 +104,14 @@ class SendContact(TelegramMethod[Message]):
first_name=first_name,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
last_name=last_name,
vcard=vcard,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from ..types import (
ChatIdUnion,
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -25,6 +31,8 @@ class SendDice(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
emoji: Optional[str] = None
"""Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '', and values 1-64 for '🎰'. Defaults to '🎲'"""
disable_notification: Optional[bool] = None
@ -35,6 +43,8 @@ class SendDice(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -62,11 +72,13 @@ class SendDice(TelegramMethod[Message]):
chat_id: ChatIdUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -81,11 +93,13 @@ class SendDice(TelegramMethod[Message]):
chat_id=chat_id,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -13,6 +13,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -35,6 +36,8 @@ class SendDocument(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
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>`"""
caption: Optional[str] = None
@ -53,6 +56,8 @@ class SendDocument(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -81,6 +86,7 @@ class SendDocument(TelegramMethod[Message]):
document: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -90,6 +96,7 @@ class SendDocument(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -105,6 +112,7 @@ class SendDocument(TelegramMethod[Message]):
document=document,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
@ -114,6 +122,7 @@ class SendDocument(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -20,7 +20,7 @@ class SendGame(TelegramMethod[Message]):
__api_method__ = "sendGame"
chat_id: int
"""Unique identifier for the target chat"""
"""Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats."""
game_short_name: str
"""Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather <https://t.me/botfather>`_."""
business_connection_id: Optional[str] = None

View file

@ -11,6 +11,7 @@ from ..types import (
LabeledPrice,
Message,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -39,6 +40,8 @@ class SendInvoice(TelegramMethod[Message]):
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
provider_token: Optional[str] = None
"""Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
max_tip_amount: Optional[int] = None
@ -79,6 +82,8 @@ class SendInvoice(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None
@ -110,6 +115,7 @@ class SendInvoice(TelegramMethod[Message]):
currency: str,
prices: list[LabeledPrice],
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
provider_token: Optional[str] = None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[list[int]] = None,
@ -130,6 +136,7 @@ class SendInvoice(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -148,6 +155,7 @@ class SendInvoice(TelegramMethod[Message]):
currency=currency,
prices=prices,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
provider_token=provider_token,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
@ -168,6 +176,7 @@ class SendInvoice(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from ..types import (
ChatIdUnion,
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -29,6 +35,8 @@ class SendLocation(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
horizontal_accuracy: Optional[float] = None
"""The radius of uncertainty for the location, measured in meters; 0-1500"""
live_period: Optional[int] = None
@ -45,6 +53,8 @@ class SendLocation(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -74,6 +84,7 @@ class SendLocation(TelegramMethod[Message]):
longitude: float,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
horizontal_accuracy: Optional[float] = None,
live_period: Optional[int] = None,
heading: Optional[int] = None,
@ -82,6 +93,7 @@ class SendLocation(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -98,6 +110,7 @@ class SendLocation(TelegramMethod[Message]):
longitude=longitude,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
horizontal_accuracy=horizontal_accuracy,
live_period=live_period,
heading=heading,
@ -106,6 +119,7 @@ class SendLocation(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -11,7 +11,7 @@ from .base import TelegramMethod
class SendMediaGroup(TelegramMethod[list[Message]]):
"""
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of `Messages <https://core.telegram.org/bots/api#message>`_ that were sent is returned.
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of :class:`aiogram.types.message.Message` objects that were sent is returned.
Source: https://core.telegram.org/bots/api#sendmediagroup
"""
@ -27,6 +27,8 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
disable_notification: Optional[bool] = None
"""Sends messages `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")
@ -61,6 +63,7 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
media: list[MediaUnion],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
@ -79,6 +82,7 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
media=media,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,

View file

@ -12,6 +12,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -34,6 +35,8 @@ class SendMessage(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
entities: Optional[list[MessageEntity]] = None
@ -48,6 +51,8 @@ class SendMessage(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -83,6 +88,7 @@ class SendMessage(TelegramMethod[Message]):
text: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
entities: Optional[list[MessageEntity]] = None,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default(
@ -92,6 +98,7 @@ class SendMessage(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -110,6 +117,7 @@ class SendMessage(TelegramMethod[Message]):
text=text,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
parse_mode=parse_mode,
entities=entities,
link_preview_options=link_preview_options,
@ -117,6 +125,7 @@ class SendMessage(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -9,6 +9,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -31,6 +32,10 @@ class SendPaidMedia(TelegramMethod[Message]):
"""A JSON-serialized array describing the media to be sent; up to 10 items"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
payload: Optional[str] = None
"""Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."""
caption: Optional[str] = None
@ -47,6 +52,8 @@ class SendPaidMedia(TelegramMethod[Message]):
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -63,6 +70,8 @@ class SendPaidMedia(TelegramMethod[Message]):
star_count: int,
media: list[InputPaidMediaUnion],
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
@ -71,6 +80,7 @@ class SendPaidMedia(TelegramMethod[Message]):
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_paid_broadcast: Optional[bool] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
**__pydantic_kwargs: Any,
@ -84,6 +94,8 @@ class SendPaidMedia(TelegramMethod[Message]):
star_count=star_count,
media=media,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
payload=payload,
caption=caption,
parse_mode=parse_mode,
@ -92,6 +104,7 @@ class SendPaidMedia(TelegramMethod[Message]):
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
**__pydantic_kwargs,

View file

@ -12,6 +12,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -34,6 +35,8 @@ class SendPhoto(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None
"""Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
@ -52,6 +55,8 @@ class SendPhoto(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -80,6 +85,7 @@ class SendPhoto(TelegramMethod[Message]):
photo: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
@ -91,6 +97,7 @@ class SendPhoto(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -106,6 +113,7 @@ class SendPhoto(TelegramMethod[Message]):
photo=photo,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -115,6 +123,7 @@ class SendPhoto(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -28,7 +28,7 @@ class SendPoll(TelegramMethod[Message]):
__api_method__ = "sendPoll"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). Polls can't be sent to channel direct messages chats."""
question: str
"""Poll question, 1-300 characters"""
options: list[InputPollOptionUnion]

View file

@ -11,6 +11,7 @@ from ..types import (
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -33,6 +34,8 @@ class SendSticker(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
emoji: Optional[str] = None
"""Emoji associated with the sticker; only for just uploaded stickers"""
disable_notification: Optional[bool] = None
@ -43,6 +46,8 @@ class SendSticker(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -71,11 +76,13 @@ class SendSticker(TelegramMethod[Message]):
sticker: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -91,11 +98,13 @@ class SendSticker(TelegramMethod[Message]):
sticker=sticker,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -5,7 +5,13 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from ..types import (
ChatIdUnion,
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -33,6 +39,8 @@ class SendVenue(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
foursquare_id: Optional[str] = None
"""Foursquare identifier of the venue"""
foursquare_type: Optional[str] = None
@ -49,6 +57,8 @@ class SendVenue(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -80,6 +90,7 @@ class SendVenue(TelegramMethod[Message]):
address: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
foursquare_id: Optional[str] = None,
foursquare_type: Optional[str] = None,
google_place_id: Optional[str] = None,
@ -88,6 +99,7 @@ class SendVenue(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -106,6 +118,7 @@ class SendVenue(TelegramMethod[Message]):
address=address,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
foursquare_id=foursquare_id,
foursquare_type=foursquare_type,
google_place_id=google_place_id,
@ -114,6 +127,7 @@ class SendVenue(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -14,6 +14,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -36,6 +37,8 @@ class SendVideo(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None
"""Duration of sent video in seconds"""
width: Optional[int] = None
@ -68,6 +71,8 @@ class SendVideo(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -96,6 +101,7 @@ class SendVideo(TelegramMethod[Message]):
video: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
@ -114,6 +120,7 @@ class SendVideo(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -129,6 +136,7 @@ class SendVideo(TelegramMethod[Message]):
video=video,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
duration=duration,
width=width,
height=height,
@ -145,6 +153,7 @@ class SendVideo(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -12,6 +12,7 @@ from ..types import (
Message,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -34,6 +35,8 @@ class SendVideoNote(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None
"""Duration of sent video in seconds"""
length: Optional[int] = None
@ -48,6 +51,8 @@ class SendVideoNote(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -76,6 +81,7 @@ class SendVideoNote(TelegramMethod[Message]):
video_note: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
duration: Optional[int] = None,
length: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
@ -83,6 +89,7 @@ class SendVideoNote(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -98,6 +105,7 @@ class SendVideoNote(TelegramMethod[Message]):
video_note=video_note,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
duration=duration,
length=length,
thumbnail=thumbnail,
@ -105,6 +113,7 @@ class SendVideoNote(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -12,6 +12,7 @@ from ..types import (
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
SuggestedPostParameters,
)
from .base import TelegramMethod
@ -34,6 +35,8 @@ class SendVoice(TelegramMethod[Message]):
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
direct_messages_topic_id: Optional[int] = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None
"""Voice message caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
@ -50,6 +53,8 @@ class SendVoice(TelegramMethod[Message]):
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
@ -78,6 +83,7 @@ class SendVoice(TelegramMethod[Message]):
voice: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
direct_messages_topic_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
@ -86,6 +92,7 @@ class SendVoice(TelegramMethod[Message]):
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
@ -101,6 +108,7 @@ class SendVoice(TelegramMethod[Message]):
voice=voice,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
direct_messages_topic_id=direct_messages_topic_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@ -109,6 +117,7 @@ class SendVoice(TelegramMethod[Message]):
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
suggested_post_parameters=suggested_post_parameters,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class UnpinAllChatMessages(TelegramMethod[bool]):
"""
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success.
Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#unpinallchatmessages
"""

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class UnpinChatMessage(TelegramMethod[bool]):
"""
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success.
Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#unpinchatmessage
"""

View file

@ -17,7 +17,7 @@ class VerifyChat(TelegramMethod[bool]):
__api_method__ = "verifyChat"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). Channel direct messages chats can't be verified."""
custom_description: Optional[str] = None
"""Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."""