Dev 3.x api 5.4 (#744)

* Re-generate API

* Added new modules

* Added handling new event type and approve/decline aliases for ChatJoinRequest

* Fixed code-coverage

* Bump API version

* Added patch-notes
This commit is contained in:
Alex Root Junior 2021-11-08 02:37:37 +02:00 committed by GitHub
parent 3ad16be507
commit 9b43a33b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 631 additions and 199 deletions

View file

@ -3,12 +3,14 @@ from .answer_callback_query import AnswerCallbackQuery
from .answer_inline_query import AnswerInlineQuery
from .answer_pre_checkout_query import AnswerPreCheckoutQuery
from .answer_shipping_query import AnswerShippingQuery
from .approve_chat_join_request import ApproveChatJoinRequest
from .ban_chat_member import BanChatMember
from .base import Request, Response, TelegramMethod
from .close import Close
from .copy_message import CopyMessage
from .create_chat_invite_link import CreateChatInviteLink
from .create_new_sticker_set import CreateNewStickerSet
from .decline_chat_join_request import DeclineChatJoinRequest
from .delete_chat_photo import DeleteChatPhoto
from .delete_chat_sticker_set import DeleteChatStickerSet
from .delete_message import DeleteMessage
@ -123,6 +125,8 @@ __all__ = (
"CreateChatInviteLink",
"EditChatInviteLink",
"RevokeChatInviteLink",
"ApproveChatJoinRequest",
"DeclineChatJoinRequest",
"SetChatPhoto",
"DeleteChatPhoto",
"SetChatTitle",

View file

@ -24,7 +24,7 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
text: Optional[str] = None
"""Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters"""
show_alert: Optional[bool] = None
"""If *true*, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*."""
"""If :code:`True`, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*."""
url: Optional[str] = None
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@Botfather <https://t.me/botfather>`_, specify the URL that opens your game — note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button."""
cache_time: Optional[int] = None

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class AnswerPreCheckoutQuery(TelegramMethod[bool]):
"""
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, True is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, :code:`True` is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
Source: https://core.telegram.org/bots/api#answerprecheckoutquery
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class AnswerShippingQuery(TelegramMethod[bool]):
"""
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, True is returned.
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, :code:`True` is returned.
Source: https://core.telegram.org/bots/api#answershippingquery
"""
@ -21,9 +21,9 @@ class AnswerShippingQuery(TelegramMethod[bool]):
shipping_query_id: str
"""Unique identifier for the query to be answered"""
ok: bool
"""Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)"""
"""Specify :code:`True` if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)"""
shipping_options: Optional[List[ShippingOption]] = None
"""Required if *ok* is True. A JSON-serialized array of available shipping options."""
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
error_message: Optional[str] = None
"""Required if *ok* is 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."""

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class ApproveChatJoinRequest(TelegramMethod[bool]):
"""
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#approvechatjoinrequest
"""
__returning__ = bool
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="approveChatJoinRequest", data=data)

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class BanChatMember(TelegramMethod[bool]):
"""
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#banchatmember
"""

View file

@ -37,7 +37,7 @@ class CopyMessage(TelegramMethod[MessageId]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the new caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the new caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*"""
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."""
reply_to_message_id: Optional[int] = None

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#createchatinvitelink
"""
@ -20,10 +20,14 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[int] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class DeclineChatJoinRequest(TelegramMethod[bool]):
"""
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#declinechatjoinrequest
"""
__returning__ = bool
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="declineChatJoinRequest", data=data)

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class DeleteChatPhoto(TelegramMethod[bool]):
"""
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletechatphoto
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class DeleteChatStickerSet(TelegramMethod[bool]):
"""
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletechatstickerset
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#editchatinvitelink
"""
@ -22,10 +22,14 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to edit"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[int] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()

View file

@ -29,7 +29,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_."""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Source: https://core.telegram.org/bots/api#editmessagemedia
"""

View file

@ -29,7 +29,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
parse_mode: Optional[str] = UNSET
"""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
"""List of special entities that appear in message text, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
disable_web_page_preview: Optional[bool] = None
"""Disables link previews for links in this message"""
reply_markup: Optional[InlineKeyboardMarkup] = None

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class ExportChatInviteLink(TelegramMethod[str]):
"""
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as *String* on success.
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as *String* on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` or by calling the :class:`aiogram.methods.get_chat.GetChat` method. If your bot needs to generate a new primary invite link replacing its previous one, use :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` again.

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class GetMe(TelegramMethod[User]):
"""
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object.
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object.
Source: https://core.telegram.org/bots/api#getme
"""

View file

@ -15,7 +15,7 @@ class KickChatMember(TelegramMethod[bool]):
Renamed from :code:`kickChatMember` in 5.3 bot API version and can be removed in near future
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#banchatmember
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
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' admin right in a supergroup or 'can_edit_messages' admin 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. 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.
Source: https://core.telegram.org/bots/api#pinchatmessage
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class PromoteChatMember(TelegramMethod[bool]):
"""
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass :code:`False` for all boolean parameters to demote a user. Returns :code:`True` on success.
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass :code:`False` for all boolean parameters to demote a user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#promotechatmember
"""
@ -24,25 +24,25 @@ class PromoteChatMember(TelegramMethod[bool]):
is_anonymous: Optional[bool] = None
"""Pass :code:`True`, if the administrator's presence in the chat is hidden"""
can_manage_chat: Optional[bool] = None
"""Pass True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
"""Pass :code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
can_post_messages: Optional[bool] = None
"""Pass True, if the administrator can create channel posts, channels only"""
"""Pass :code:`True`, if the administrator can create channel posts, channels only"""
can_edit_messages: Optional[bool] = None
"""Pass True, if the administrator can edit messages of other users and can pin messages, channels only"""
"""Pass :code:`True`, if the administrator can edit messages of other users and can pin messages, channels only"""
can_delete_messages: Optional[bool] = None
"""Pass True, if the administrator can delete messages of other users"""
"""Pass :code:`True`, if the administrator can delete messages of other users"""
can_manage_voice_chats: Optional[bool] = None
"""Pass True, if the administrator can manage voice chats"""
"""Pass :code:`True`, if the administrator can manage voice chats"""
can_restrict_members: Optional[bool] = None
"""Pass True, if the administrator can restrict, ban or unban chat members"""
"""Pass :code:`True`, if the administrator can restrict, ban or unban chat members"""
can_promote_members: Optional[bool] = None
"""Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
"""Pass :code:`True`, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
can_change_info: Optional[bool] = None
"""Pass True, if the administrator can change chat title, photo and other settings"""
"""Pass :code:`True`, if the administrator can change chat title, photo and other settings"""
can_invite_users: Optional[bool] = None
"""Pass True, if the administrator can invite new users to the chat"""
"""Pass :code:`True`, if the administrator can invite new users to the chat"""
can_pin_messages: Optional[bool] = None
"""Pass True, if the administrator can pin messages, supergroups only"""
"""Pass :code:`True`, if the administrator can pin messages, supergroups only"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()

View file

@ -12,7 +12,7 @@ if TYPE_CHECKING:
class RestrictChatMember(TelegramMethod[bool]):
"""
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success.
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#restrictchatmember
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class RevokeChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the revoked invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#revokechatinvitelink
"""

View file

@ -44,7 +44,7 @@ class SendAnimation(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
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."""
reply_to_message_id: Optional[int] = None

View file

@ -37,7 +37,7 @@ class SendAudio(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
duration: Optional[int] = None
"""Duration of the audio in seconds"""
performer: Optional[str] = None

View file

@ -24,7 +24,7 @@ class SendChatAction(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *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>`_."""
"""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>`_."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()

View file

@ -38,7 +38,7 @@ class SendDocument(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
disable_content_type_detection: Optional[bool] = None
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
disable_notification: Optional[bool] = None

View file

@ -33,7 +33,7 @@ class SendMessage(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""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
"""List of special entities that appear in message text, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
disable_web_page_preview: Optional[bool] = None
"""Disables link previews for links in this message"""
disable_notification: Optional[bool] = None

View file

@ -36,7 +36,7 @@ class SendPhoto(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
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."""
reply_to_message_id: Optional[int] = None

View file

@ -34,11 +34,11 @@ class SendPoll(TelegramMethod[Message]):
options: List[str]
"""A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"""
is_anonymous: Optional[bool] = None
"""True, if the poll needs to be anonymous, defaults to :code:`True`"""
""":code:`True`, if the poll needs to be anonymous, defaults to :code:`True`"""
type: Optional[str] = None
"""Poll type, 'quiz' or 'regular', defaults to 'regular'"""
allows_multiple_answers: Optional[bool] = None
"""True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`"""
""":code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`"""
correct_option_id: Optional[int] = None
"""0-based identifier of the correct answer option, required for polls in quiz mode"""
explanation: Optional[str] = None
@ -46,7 +46,7 @@ class SendPoll(TelegramMethod[Message]):
explanation_parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the explanation. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
explanation_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the poll explanation, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of *parse_mode*"""
open_period: Optional[int] = None
"""Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*."""
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None

View file

@ -44,7 +44,7 @@ class SendVideo(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
supports_streaming: Optional[bool] = None
"""Pass :code:`True`, if the uploaded video is suitable for streaming"""
disable_notification: Optional[bool] = None

View file

@ -36,7 +36,7 @@ class SendVoice(TelegramMethod[Message]):
parse_mode: Optional[str] = UNSET
"""Mode for parsing entities in the voice message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
duration: Optional[int] = None
"""Duration of the voice message in seconds"""
disable_notification: Optional[bool] = None

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class SetChatDescription(TelegramMethod[bool]):
"""
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchatdescription
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class SetChatPermissions(TelegramMethod[bool]):
"""
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* admin rights. Returns :code:`True` on success.
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchatpermissions
"""
@ -21,7 +21,7 @@ class SetChatPermissions(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
permissions: ChatPermissions
"""New default chat permissions"""
"""A JSON-serialized object for new default chat permissions"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class SetChatPhoto(TelegramMethod[bool]):
"""
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchatphoto
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class SetChatStickerSet(TelegramMethod[bool]):
"""
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchatstickerset
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
class SetChatTitle(TelegramMethod[bool]):
"""
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchattitle
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class SetGameScore(TelegramMethod[Union[Message, bool]]):
"""
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited :class:`aiogram.types.message.Message`, otherwise returns :code:`True`. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`.
Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`.
Source: https://core.telegram.org/bots/api#setgamescore
"""
@ -23,9 +23,9 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
score: int
"""New score, must be non-negative"""
force: Optional[bool] = None
"""Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"""
"""Pass :code:`True`, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"""
disable_edit_message: Optional[bool] = None
"""Pass True, if the game message should not be automatically edited to include the current scoreboard"""
"""Pass :code:`True`, if the game message should not be automatically edited to include the current scoreboard"""
chat_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat"""
message_id: Optional[int] = None

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""
Use this method to stop updating a live location message before *live_period* expires. On success, if the message was sent by the bot, the sent :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Source: https://core.telegram.org/bots/api#stopmessagelivelocation
"""

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class StopPoll(TelegramMethod[Poll]):
"""
Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` with the final results is returned.
Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned.
Source: https://core.telegram.org/bots/api#stoppoll
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
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' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
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.
Source: https://core.telegram.org/bots/api#unpinallchatmessages
"""

View file

@ -10,7 +10,7 @@ if TYPE_CHECKING:
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' admin right in a supergroup or 'can_edit_messages' admin 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. 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.
Source: https://core.telegram.org/bots/api#unpinchatmessage
"""