From 49526814d9dfa076ed2c400a8a5f4541b8f4d332 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Thu, 14 Nov 2019 22:19:33 +0200 Subject: [PATCH] Reformat descriptions (long lines) --- aiogram/api/client/bot.py | 1317 +++++++++-------- aiogram/api/methods/add_sticker_to_set.py | 9 +- aiogram/api/methods/answer_callback_query.py | 27 +- aiogram/api/methods/answer_inline_query.py | 25 +- .../api/methods/answer_pre_checkout_query.py | 15 +- aiogram/api/methods/answer_shipping_query.py | 14 +- aiogram/api/methods/create_new_sticker_set.py | 19 +- aiogram/api/methods/delete_chat_photo.py | 7 +- .../api/methods/delete_chat_sticker_set.py | 8 +- aiogram/api/methods/delete_message.py | 10 +- aiogram/api/methods/delete_webhook.py | 3 +- aiogram/api/methods/edit_message_caption.py | 14 +- .../api/methods/edit_message_live_location.py | 13 +- aiogram/api/methods/edit_message_media.py | 5 +- .../api/methods/edit_message_reply_markup.py | 9 +- aiogram/api/methods/edit_message_text.py | 15 +- .../api/methods/export_chat_invite_link.py | 13 +- aiogram/api/methods/forward_message.py | 9 +- aiogram/api/methods/get_chat.py | 7 +- .../api/methods/get_chat_administrators.py | 8 +- aiogram/api/methods/get_chat_member.py | 7 +- aiogram/api/methods/get_chat_members_count.py | 3 +- aiogram/api/methods/get_file.py | 9 +- aiogram/api/methods/get_game_high_scores.py | 10 +- aiogram/api/methods/get_me.py | 3 +- aiogram/api/methods/get_updates.py | 26 +- .../api/methods/get_user_profile_photos.py | 8 +- aiogram/api/methods/get_webhook_info.py | 4 +- aiogram/api/methods/kick_chat_member.py | 13 +- aiogram/api/methods/leave_chat.py | 3 +- aiogram/api/methods/pin_chat_message.py | 12 +- aiogram/api/methods/promote_chat_member.py | 23 +- aiogram/api/methods/restrict_chat_member.py | 14 +- aiogram/api/methods/send_animation.py | 34 +- aiogram/api/methods/send_audio.py | 35 +- aiogram/api/methods/send_chat_action.py | 21 +- aiogram/api/methods/send_contact.py | 13 +- aiogram/api/methods/send_document.py | 31 +- aiogram/api/methods/send_game.py | 10 +- aiogram/api/methods/send_invoice.py | 40 +- aiogram/api/methods/send_location.py | 15 +- aiogram/api/methods/send_media_group.py | 12 +- aiogram/api/methods/send_message.py | 15 +- aiogram/api/methods/send_photo.py | 19 +- aiogram/api/methods/send_poll.py | 14 +- aiogram/api/methods/send_sticker.py | 17 +- aiogram/api/methods/send_venue.py | 18 +- aiogram/api/methods/send_video.py | 35 +- aiogram/api/methods/send_video_note.py | 27 +- aiogram/api/methods/send_voice.py | 26 +- aiogram/api/methods/set_chat_description.py | 8 +- aiogram/api/methods/set_chat_permissions.py | 8 +- aiogram/api/methods/set_chat_photo.py | 8 +- aiogram/api/methods/set_chat_sticker_set.py | 9 +- aiogram/api/methods/set_chat_title.py | 8 +- aiogram/api/methods/set_game_score.py | 16 +- .../api/methods/set_passport_data_errors.py | 10 +- .../methods/set_sticker_position_in_set.py | 4 +- aiogram/api/methods/set_webhook.py | 35 +- .../api/methods/stop_message_live_location.py | 13 +- aiogram/api/methods/stop_poll.py | 8 +- aiogram/api/methods/unban_chat_member.py | 8 +- aiogram/api/methods/unpin_chat_message.py | 7 +- aiogram/api/methods/upload_sticker_file.py | 7 +- aiogram/api/types/callback_query.py | 20 +- aiogram/api/types/chat.py | 11 +- aiogram/api/types/chat_member.py | 31 +- aiogram/api/types/chat_permissions.py | 12 +- aiogram/api/types/chat_photo.py | 6 +- aiogram/api/types/chosen_inline_result.py | 10 +- aiogram/api/types/encrypted_credentials.py | 10 +- .../api/types/encrypted_passport_element.py | 33 +- aiogram/api/types/file.py | 5 +- aiogram/api/types/force_reply.py | 26 +- aiogram/api/types/game.py | 7 +- aiogram/api/types/inline_keyboard_button.py | 28 +- aiogram/api/types/inline_keyboard_markup.py | 6 +- aiogram/api/types/inline_query.py | 3 +- aiogram/api/types/inline_query_result.py | 3 +- .../api/types/inline_query_result_article.py | 2 +- .../api/types/inline_query_result_audio.py | 12 +- .../types/inline_query_result_cached_audio.py | 12 +- .../inline_query_result_cached_document.py | 12 +- .../types/inline_query_result_cached_gif.py | 9 +- .../inline_query_result_cached_mpeg4_gif.py | 10 +- .../types/inline_query_result_cached_photo.py | 9 +- .../inline_query_result_cached_sticker.py | 9 +- .../types/inline_query_result_cached_video.py | 9 +- .../types/inline_query_result_cached_voice.py | 12 +- .../api/types/inline_query_result_contact.py | 9 +- .../api/types/inline_query_result_document.py | 13 +- aiogram/api/types/inline_query_result_game.py | 3 +- aiogram/api/types/inline_query_result_gif.py | 9 +- .../api/types/inline_query_result_location.py | 9 +- .../types/inline_query_result_mpeg4_gif.py | 10 +- .../api/types/inline_query_result_photo.py | 9 +- .../api/types/inline_query_result_venue.py | 11 +- .../api/types/inline_query_result_video.py | 15 +- .../api/types/inline_query_result_voice.py | 13 +- aiogram/api/types/input_file.py | 3 +- aiogram/api/types/input_media_animation.py | 15 +- aiogram/api/types/input_media_audio.py | 15 +- aiogram/api/types/input_media_document.py | 15 +- aiogram/api/types/input_media_photo.py | 8 +- aiogram/api/types/input_media_video.py | 15 +- aiogram/api/types/input_message_content.py | 3 +- .../api/types/input_text_message_content.py | 3 +- .../api/types/input_venue_message_content.py | 3 +- aiogram/api/types/invoice.py | 5 +- aiogram/api/types/keyboard_button.py | 16 +- aiogram/api/types/labeled_price.py | 5 +- aiogram/api/types/login_url.py | 17 +- aiogram/api/types/mask_position.py | 9 +- aiogram/api/types/message.py | 77 +- aiogram/api/types/message_entity.py | 8 +- aiogram/api/types/passport_data.py | 3 +- aiogram/api/types/passport_element_error.py | 3 +- .../passport_element_error_data_field.py | 6 +- .../api/types/passport_element_error_file.py | 6 +- .../api/types/passport_element_error_files.py | 6 +- .../passport_element_error_front_side.py | 6 +- .../passport_element_error_reverse_side.py | 6 +- .../types/passport_element_error_selfie.py | 6 +- ...passport_element_error_translation_file.py | 7 +- ...assport_element_error_translation_files.py | 7 +- .../passport_element_error_unspecified.py | 3 +- aiogram/api/types/passport_file.py | 3 +- aiogram/api/types/pre_checkout_query.py | 7 +- aiogram/api/types/reply_keyboard_markup.py | 18 +- aiogram/api/types/reply_keyboard_remove.py | 15 +- aiogram/api/types/response_parameters.py | 8 +- aiogram/api/types/shipping_query.py | 2 +- aiogram/api/types/successful_payment.py | 5 +- aiogram/api/types/update.py | 19 +- aiogram/api/types/venue.py | 3 +- aiogram/api/types/webhook_info.py | 6 +- 136 files changed, 1713 insertions(+), 1270 deletions(-) diff --git a/aiogram/api/client/bot.py b/aiogram/api/client/bot.py index 1eaee1d9..3c2077ba 100644 --- a/aiogram/api/client/bot.py +++ b/aiogram/api/client/bot.py @@ -116,23 +116,34 @@ class Bot(BaseBot): allowed_updates: Optional[List[str]] = None, ) -> List[Update]: """ - Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. + Use this method to receive incoming updates using long polling (wiki). An Array of Update + objects is returned. Notes 1. This method will not work if an outgoing webhook is set up. - 2. In order to avoid getting duplicate updates, recalculate offset after each server response. + 2. In order to avoid getting duplicate updates, recalculate offset after each server + response. Source: https://core.telegram.org/bots/api#getupdates - :param offset: Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. - :type offset: :obj:`Optional[int]` - :param limit: Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100. - :type limit: :obj:`Optional[int]` - :param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. - :type timeout: :obj:`Optional[int]` - :param allowed_updates: List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. - :type allowed_updates: :obj:`Optional[List[str]]` + :param offset: Identifier of the first update to be returned. Must be greater by one than + the highest among the identifiers of previously received updates. By + default, updates starting with the earliest unconfirmed update are + returned. An update is considered confirmed as soon as getUpdates is called + with an offset higher than its update_id. The negative offset can be + specified to retrieve updates starting from -offset update from the end of + the updates queue. All previous updates will forgotten. + :param limit: Limits the number of updates to be retrieved. Values between 1—100 are + accepted. Defaults to 100. + :param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short + polling. Should be positive, short polling should be used for testing + purposes only. + :param allowed_updates: List the types of updates you want your bot to receive. For + example, specify ['message', 'edited_channel_post', + 'callback_query'] to only receive updates of these types. See + Update for a complete list of available update types. Specify an + empty list to receive all updates regardless of type (default). If + not specified, the previous setting will be used. :return: An Array of Update objects is returned. - :rtype: :obj:`List[Update]` """ call = GetUpdates( offset=offset, limit=limit, timeout=timeout, allowed_updates=allowed_updates, @@ -147,26 +158,39 @@ class Bot(BaseBot): allowed_updates: Optional[List[str]] = None, ) -> bool: """ - Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. - If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/. Since nobody else knows your bot‘s token, you can be pretty sure it’s us. + Use this method to specify a url and receive incoming updates via an outgoing webhook. + Whenever there is an update for the bot, we will send an HTTPS POST request to the + specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we + will give up after a reasonable amount of attempts. Returns True on success. + If you'd like to make sure that the Webhook request comes from Telegram, we recommend + using a secret path in the URL, e.g. https://www.example.com/. Since nobody else + knows your bot‘s token, you can be pretty sure it’s us. Notes - 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. - 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. + 1. You will not be able to receive updates using getUpdates for as long as an outgoing + webhook is set up. + 2. To use a self-signed certificate, you need to upload your public key certificate using + certificate parameter. Please upload as InputFile, sending a String will not work. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443. - NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks. + NEW! If you're having any trouble setting up webhooks, please check out this amazing guide + to Webhooks. Source: https://core.telegram.org/bots/api#setwebhook - :param url: HTTPS url to send updates to. Use an empty string to remove webhook integration - :type url: :obj:`str` - :param certificate: Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details. - :type certificate: :obj:`Optional[InputFile]` - :param max_connections: Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput. - :type max_connections: :obj:`Optional[int]` - :param allowed_updates: List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. - :type allowed_updates: :obj:`Optional[List[str]]` + :param url: HTTPS url to send updates to. Use an empty string to remove webhook + integration + :param certificate: Upload your public key certificate so that the root certificate in use + can be checked. See our self-signed guide for details. + :param max_connections: Maximum allowed number of simultaneous HTTPS connections to the + webhook for update delivery, 1-100. Defaults to 40. Use lower + values to limit the load on your bot‘s server, and higher values + to increase your bot’s throughput. + :param allowed_updates: List the types of updates you want your bot to receive. For + example, specify ['message', 'edited_channel_post', + 'callback_query'] to only receive updates of these types. See + Update for a complete list of available update types. Specify an + empty list to receive all updates regardless of type (default). If + not specified, the previous setting will be used. :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetWebhook( url=url, @@ -178,24 +202,26 @@ class Bot(BaseBot): async def delete_webhook(self,) -> bool: """ - Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. + Use this method to remove webhook integration if you decide to switch back to getUpdates. + Returns True on success. Requires no parameters. Source: https://core.telegram.org/bots/api#deletewebhook :return: Returns True on success. - :rtype: :obj:`bool` """ call = DeleteWebhook() return await self.emit(call) async def get_webhook_info(self,) -> WebhookInfo: """ - Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. + Use this method to get current webhook status. Requires no parameters. On success, returns + a WebhookInfo object. If the bot is using getUpdates, will return an object with the url + field empty. Source: https://core.telegram.org/bots/api#getwebhookinfo - :return: On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. - :rtype: :obj:`WebhookInfo` + :return: On success, returns a WebhookInfo object. If the bot is using getUpdates, will + return an object with the url field empty. """ call = GetWebhookInfo() return await self.emit(call) @@ -207,12 +233,12 @@ class Bot(BaseBot): async def get_me(self,) -> User: """ - A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object. + A simple method for testing your bot's auth token. Requires no parameters. Returns basic + information about the bot in form of a User object. Source: https://core.telegram.org/bots/api#getme :return: Returns basic information about the bot in form of a User object. - :rtype: :obj:`User` """ call = GetMe() return await self.emit(call) @@ -234,22 +260,19 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendmessage - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param text: Text of the message to be sent - :type text: :obj:`str` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - :type parse_mode: :obj:`Optional[str]` + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in your bot's message. :param disable_web_page_preview: Disables link previews for links in this message - :type disable_web_page_preview: :obj:`Optional[bool]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendMessage( chat_id=chat_id, @@ -274,16 +297,14 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#forwardmessage - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) - :type from_chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param from_chat_id: Unique identifier for the chat where the original message was sent + (or channel username in the format @channelusername) :param message_id: Message identifier in the chat specified in from_chat_id - :type message_id: :obj:`int` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = ForwardMessage( chat_id=chat_id, @@ -310,22 +331,23 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendphoto - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param photo: Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. - :type photo: :obj:`Union[InputFile, str]` - :param caption: Photo caption (may also be used when resending photos by file_id), 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param photo: Photo to send. Pass a file_id as String to send a photo that exists on the + Telegram servers (recommended), pass an HTTP URL as a String for Telegram to + get a photo from the Internet, or upload a new photo using + multipart/form-data. + :param caption: Photo caption (may also be used when resending photos by file_id), 0-1024 + characters + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendPhoto( chat_id=chat_id, @@ -355,35 +377,40 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send audio files, if you want Telegram clients to display them in the + music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message + is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be + changed in the future. For sending voice messages, use the sendVoice method instead. Source: https://core.telegram.org/bots/api#sendaudio - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param audio: Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. - :type audio: :obj:`Union[InputFile, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param audio: Audio file to send. Pass a file_id as String to send an audio file that + exists on the Telegram servers (recommended), pass an HTTP URL as a String + for Telegram to get an audio file from the Internet, or upload a new one + using multipart/form-data. :param caption: Audio caption, 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. :param duration: Duration of the audio in seconds - :type duration: :obj:`Optional[int]` :param performer: Performer - :type performer: :obj:`Optional[str]` :param title: Track name - :type title: :obj:`Optional[str]` - :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . - :type thumb: :obj:`Optional[Union[InputFile, str]]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the + file is supported server-side. The thumbnail should be in JPEG format and + less than 200 kB in size. A thumbnail‘s width and height should not exceed + 320. Ignored if the file is not uploaded using multipart/form-data. + Thumbnails can’t be reused and can be only uploaded as a new file, so you + can pass 'attach://' if the thumbnail was uploaded using + multipart/form-data under . + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendAudio( chat_id=chat_id, @@ -414,28 +441,36 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. + Use this method to send general files. On success, the sent Message is returned. Bots can + currently send files of any type of up to 50 MB in size, this limit may be changed in the + future. Source: https://core.telegram.org/bots/api#senddocument - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param document: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. - :type document: :obj:`Union[InputFile, str]` - :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . - :type thumb: :obj:`Optional[Union[InputFile, str]]` - :param caption: Document caption (may also be used when resending documents by file_id), 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param document: File to send. Pass a file_id as String to send a file that exists on the + Telegram servers (recommended), pass an HTTP URL as a String for Telegram + to get a file from the Internet, or upload a new one using + multipart/form-data. + :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the + file is supported server-side. The thumbnail should be in JPEG format and + less than 200 kB in size. A thumbnail‘s width and height should not exceed + 320. Ignored if the file is not uploaded using multipart/form-data. + Thumbnails can’t be reused and can be only uploaded as a new file, so you + can pass 'attach://' if the thumbnail was uploaded using + multipart/form-data under . + :param caption: Document caption (may also be used when resending documents by file_id), + 0-1024 characters + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendDocument( chat_id=chat_id, @@ -467,36 +502,40 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send video files, Telegram clients support mp4 videos (other formats + may be sent as Document). On success, the sent Message is returned. Bots can currently + send video files of up to 50 MB in size, this limit may be changed in the future. Source: https://core.telegram.org/bots/api#sendvideo - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param video: Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. - :type video: :obj:`Union[InputFile, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param video: Video to send. Pass a file_id as String to send a video that exists on the + Telegram servers (recommended), pass an HTTP URL as a String for Telegram to + get a video from the Internet, or upload a new video using + multipart/form-data. :param duration: Duration of sent video in seconds - :type duration: :obj:`Optional[int]` :param width: Video width - :type width: :obj:`Optional[int]` :param height: Video height - :type height: :obj:`Optional[int]` - :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . - :type thumb: :obj:`Optional[Union[InputFile, str]]` - :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` + :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the + file is supported server-side. The thumbnail should be in JPEG format and + less than 200 kB in size. A thumbnail‘s width and height should not exceed + 320. Ignored if the file is not uploaded using multipart/form-data. + Thumbnails can’t be reused and can be only uploaded as a new file, so you + can pass 'attach://' if the thumbnail was uploaded using + multipart/form-data under . + :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 + characters + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. :param supports_streaming: Pass True, if the uploaded video is suitable for streaming - :type supports_streaming: :obj:`Optional[bool]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendVideo( chat_id=chat_id, @@ -531,34 +570,39 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On + success, the sent Message is returned. Bots can currently send animation files of up to 50 + MB in size, this limit may be changed in the future. Source: https://core.telegram.org/bots/api#sendanimation - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param animation: Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. - :type animation: :obj:`Union[InputFile, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param animation: Animation to send. Pass a file_id as String to send an animation that + exists on the Telegram servers (recommended), pass an HTTP URL as a + String for Telegram to get an animation from the Internet, or upload a + new animation using multipart/form-data. :param duration: Duration of sent animation in seconds - :type duration: :obj:`Optional[int]` :param width: Animation width - :type width: :obj:`Optional[int]` :param height: Animation height - :type height: :obj:`Optional[int]` - :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . - :type thumb: :obj:`Optional[Union[InputFile, str]]` - :param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the + file is supported server-side. The thumbnail should be in JPEG format and + less than 200 kB in size. A thumbnail‘s width and height should not exceed + 320. Ignored if the file is not uploaded using multipart/form-data. + Thumbnails can’t be reused and can be only uploaded as a new file, so you + can pass 'attach://' if the thumbnail was uploaded using + multipart/form-data under . + :param caption: Animation caption (may also be used when resending animation by file_id), + 0-1024 characters + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendAnimation( chat_id=chat_id, @@ -589,28 +633,31 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. + Use this method to send audio files, if you want Telegram clients to display the file as a + playable voice message. For this to work, your audio must be in an .ogg file encoded with + OPUS (other formats may be sent as Audio or Document). On success, the sent Message is + returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be + changed in the future. Source: https://core.telegram.org/bots/api#sendvoice - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param voice: Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. - :type voice: :obj:`Union[InputFile, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param voice: Audio file to send. Pass a file_id as String to send a file that exists on + the Telegram servers (recommended), pass an HTTP URL as a String for + Telegram to get a file from the Internet, or upload a new one using + multipart/form-data. :param caption: Voice message caption, 0-1024 characters - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. :param duration: Duration of the voice message in seconds - :type duration: :obj:`Optional[int]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendVoice( chat_id=chat_id, @@ -638,28 +685,33 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. + As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. + Use this method to send video messages. On success, the sent Message is returned. Source: https://core.telegram.org/bots/api#sendvideonote - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param video_note: Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported - :type video_note: :obj:`Union[InputFile, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param video_note: Video note to send. Pass a file_id as String to send a video note that + exists on the Telegram servers (recommended) or upload a new video + using multipart/form-data.. Sending video notes by a URL is currently + unsupported :param duration: Duration of sent video in seconds - :type duration: :obj:`Optional[int]` :param length: Video width and height, i.e. diameter of the video message - :type length: :obj:`Optional[int]` - :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . - :type thumb: :obj:`Optional[Union[InputFile, str]]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the + file is supported server-side. The thumbnail should be in JPEG format and + less than 200 kB in size. A thumbnail‘s width and height should not exceed + 320. Ignored if the file is not uploaded using multipart/form-data. + Thumbnails can’t be reused and can be only uploaded as a new file, so you + can pass 'attach://' if the thumbnail was uploaded using + multipart/form-data under . + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendVideoNote( chat_id=chat_id, @@ -681,20 +733,19 @@ class Bot(BaseBot): reply_to_message_id: Optional[int] = None, ) -> List[Message]: """ - Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. + Use this method to send a group of photos or videos as an album. On success, an array of + the sent Messages is returned. Source: https://core.telegram.org/bots/api#sendmediagroup - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param media: A JSON-serialized array describing photos and videos to be sent, must include 2–10 items - :type media: :obj:`List[Union[InputMediaPhoto, InputMediaVideo]]` - :param disable_notification: Sends the messages silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param media: A JSON-serialized array describing photos and videos to be sent, must + include 2–10 items + :param disable_notification: Sends the messages silently. Users will receive a + notification with no sound. :param reply_to_message_id: If the messages are a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` :return: On success, an array of the sent Messages is returned. - :rtype: :obj:`List[Message]` """ call = SendMediaGroup( chat_id=chat_id, @@ -721,22 +772,19 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendlocation - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param latitude: Latitude of the location - :type latitude: :obj:`float` :param longitude: Longitude of the location - :type longitude: :obj:`float` - :param live_period: Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400. - :type live_period: :obj:`Optional[int]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param live_period: Period in seconds for which the location will be updated (see Live + Locations, should be between 60 and 86400. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendLocation( chat_id=chat_id, @@ -759,24 +807,25 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Union[Message, bool]: """ - Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit live location messages. A location can be edited until its + live_period expires or editing is explicitly disabled by a call to + stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited + Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagelivelocation :param latitude: Latitude of new location - :type latitude: :obj:`float` :param longitude: Longitude of new location - :type longitude: :obj:`float` - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message to edit - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message to edit + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if the edited message was sent by the bot, the edited Message is + returned, otherwise True is returned. """ call = EditMessageLiveLocation( latitude=latitude, @@ -796,20 +845,22 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> 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 Message is returned, otherwise True is returned. + 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 Message is returned, otherwise True + is returned. Source: https://core.telegram.org/bots/api#stopmessagelivelocation - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message with live location to stop - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message with live location to stop + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if the message was sent by the bot, the sent Message is returned, + otherwise True is returned. """ call = StopMessageLiveLocation( chat_id=chat_id, @@ -835,32 +886,28 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send information about a venue. On success, the sent Message is returned. + Use this method to send information about a venue. On success, the sent Message is + returned. Source: https://core.telegram.org/bots/api#sendvenue - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param latitude: Latitude of the venue - :type latitude: :obj:`float` :param longitude: Longitude of the venue - :type longitude: :obj:`float` :param title: Name of the venue - :type title: :obj:`str` :param address: Address of the venue - :type address: :obj:`str` :param foursquare_id: Foursquare identifier of the venue - :type foursquare_id: :obj:`Optional[str]` - :param foursquare_type: Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.) - :type foursquare_type: :obj:`Optional[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param foursquare_type: Foursquare type of the venue, if known. (For example, + 'arts_entertainment/default', 'arts_entertainment/aquarium' or + 'food/icecream'.) + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendVenue( chat_id=chat_id, @@ -894,24 +941,19 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendcontact - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param phone_number: Contact's phone number - :type phone_number: :obj:`str` :param first_name: Contact's first name - :type first_name: :obj:`str` :param last_name: Contact's last name - :type last_name: :obj:`Optional[str]` :param vcard: Additional data about the contact in the form of a vCard, 0-2048 bytes - :type vcard: :obj:`Optional[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove keyboard or + to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendContact( chat_id=chat_id, @@ -937,24 +979,23 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned. + Use this method to send a native poll. A native poll can't be sent to a private chat. On + success, the sent Message is returned. Source: https://core.telegram.org/bots/api#sendpoll - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat. - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername). A native poll can't be sent to a private + chat. :param question: Poll question, 1-255 characters - :type question: :obj:`str` :param options: List of answer options, 2-10 strings 1-100 characters each - :type options: :obj:`List[str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendPoll( chat_id=chat_id, @@ -968,18 +1009,26 @@ class Bot(BaseBot): async def send_chat_action(self, chat_id: Union[int, str], action: str,) -> bool: """ - Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. - Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the bot. - We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. + Use this method when you need to tell the user that something is happening on the bot's + side. The status is set for 5 seconds or less (when a message arrives from your bot, + Telegram clients clear its typing status). Returns True on success. + Example: The ImageBot needs some time to process a request and upload the image. Instead + of sending a text message along the lines of 'Retrieving image, please wait…', the bot may + use sendChatAction with action = upload_photo. The user will see a 'sending photo' status + for the bot. + We only recommend using this method when a response from the bot will take a noticeable + amount of time to arrive. Source: https://core.telegram.org/bots/api#sendchataction - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param action: Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes. - :type action: :obj:`str` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param action: Type of action to broadcast. Choose one, depending on what the user is + about to receive: typing for text messages, upload_photo for photos, + record_video or upload_video for videos, record_audio or upload_audio for + audio files, upload_document for general files, find_location for location + data, record_video_note or upload_video_note for video notes. :return: Returns True on success. - :rtype: :obj:`bool` """ call = SendChatAction(chat_id=chat_id, action=action,) return await self.emit(call) @@ -988,33 +1037,36 @@ class Bot(BaseBot): self, user_id: int, offset: Optional[int] = None, limit: Optional[int] = None, ) -> UserProfilePhotos: """ - Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. + Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos + object. Source: https://core.telegram.org/bots/api#getuserprofilephotos :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` - :param offset: Sequential number of the first photo to be returned. By default, all photos are returned. - :type offset: :obj:`Optional[int]` - :param limit: Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. - :type limit: :obj:`Optional[int]` + :param offset: Sequential number of the first photo to be returned. By default, all photos + are returned. + :param limit: Limits the number of photos to be retrieved. Values between 1—100 are + accepted. Defaults to 100. :return: Returns a UserProfilePhotos object. - :rtype: :obj:`UserProfilePhotos` """ call = GetUserProfilePhotos(user_id=user_id, offset=offset, limit=limit,) return await self.emit(call) async def get_file(self, file_id: str,) -> File: """ - Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. - Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. + Use this method to get basic info about a file and prepare it for downloading. For the + moment, bots can download files of up to 20MB in size. On success, a File object is + returned. The file can then be downloaded via the link + https://api.telegram.org/file/bot/, where is taken from the + response. It is guaranteed that the link will be valid for at least 1 hour. When the link + expires, a new one can be requested by calling getFile again. + Note: This function may not preserve the original file name and MIME type. You should save + the file's MIME type and name (if available) when the File object is received. Source: https://core.telegram.org/bots/api#getfile :param file_id: File identifier to get info about - :type file_id: :obj:`str` :return: On success, a File object is returned. - :rtype: :obj:`File` """ call = GetFile(file_id=file_id,) return await self.emit(call) @@ -1026,34 +1078,38 @@ class Bot(BaseBot): until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None, ) -> bool: """ - Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. + Use this method to kick a user from a group, a supergroup or a channel. In the case of + supergroups and channels, the user will not be able to return to the group on their own + using invite links, etc., unless unbanned first. The bot must be an administrator in the + chat for this to work and must have the appropriate admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#kickchatmember - :param chat_id: Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target group or username of the target + supergroup or channel (in the format @channelusername) :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` - :param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever - :type until_date: :obj:`Optional[Union[int, datetime.datetime, datetime.timedelta]]` - :return: In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc. Returns True on success. - :rtype: :obj:`bool` + :param until_date: Date when the user will be unbanned, unix time. If user is banned for + more than 366 days or less than 30 seconds from the current time they + are considered to be banned forever + :return: In the case of supergroups and channels, the user will not be able to return to + the group on their own using invite links, etc. Returns True on success. """ call = KickChatMember(chat_id=chat_id, user_id=user_id, until_date=until_date,) return await self.emit(call) async def unban_chat_member(self, chat_id: Union[int, str], user_id: int,) -> bool: """ - Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success. + Use this method to unban a previously kicked user in a supergroup or channel. The user + will not return to the group or channel automatically, but will be able to join via link, + etc. The bot must be an administrator for this to work. Returns True on success. Source: https://core.telegram.org/bots/api#unbanchatmember - :param chat_id: Unique identifier for the target group or username of the target supergroup or channel (in the format @username) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target group or username of the target + supergroup or channel (in the format @username) :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` - :return: The user will not return to the group or channel automatically, but will be able to join via link, etc. Returns True on success. - :rtype: :obj:`bool` + :return: The user will not return to the group or channel automatically, but will be able + to join via link, etc. Returns True on success. """ call = UnbanChatMember(chat_id=chat_id, user_id=user_id,) return await self.emit(call) @@ -1066,20 +1122,20 @@ class Bot(BaseBot): until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None, ) -> 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 True for all permissions to lift restrictions from a user. Returns 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 admin rights. Pass True for + all permissions to lift restrictions from a user. Returns True on success. Source: https://core.telegram.org/bots/api#restrictchatmember - :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + (in the format @supergroupusername) :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` :param permissions: New user permissions - :type permissions: :obj:`ChatPermissions` - :param until_date: Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever - :type until_date: :obj:`Optional[Union[int, datetime.datetime, datetime.timedelta]]` + :param until_date: Date when restrictions will be lifted for the user, unix time. If user + is restricted for more than 366 days or less than 30 seconds from the + current time, they are considered to be restricted forever :return: Returns True on success. - :rtype: :obj:`bool` """ call = RestrictChatMember( chat_id=chat_id, user_id=user_id, permissions=permissions, until_date=until_date, @@ -1100,32 +1156,33 @@ class Bot(BaseBot): can_promote_members: Optional[bool] = None, ) -> 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 False for all boolean parameters to demote a user. Returns 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 admin rights. + Pass False for all boolean parameters to demote a user. Returns True on success. Source: https://core.telegram.org/bots/api#promotechatmember - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` - :param can_change_info: Pass True, if the administrator can change chat title, photo and other settings - :type can_change_info: :obj:`Optional[bool]` - :param can_post_messages: Pass True, if the administrator can create channel posts, channels only - :type can_post_messages: :obj:`Optional[bool]` - :param can_edit_messages: Pass True, if the administrator can edit messages of other users and can pin messages, channels only - :type can_edit_messages: :obj:`Optional[bool]` - :param can_delete_messages: Pass True, if the administrator can delete messages of other users - :type can_delete_messages: :obj:`Optional[bool]` + :param can_change_info: Pass True, if the administrator can change chat title, photo and + other settings + :param can_post_messages: Pass True, if the administrator can create channel posts, + channels only + :param can_edit_messages: Pass True, if the administrator can edit messages of other users + and can pin messages, channels only + :param can_delete_messages: Pass True, if the administrator can delete messages of other + users :param can_invite_users: Pass True, if the administrator can invite new users to the chat - :type can_invite_users: :obj:`Optional[bool]` - :param can_restrict_members: Pass True, if the administrator can restrict, ban or unban chat members - :type can_restrict_members: :obj:`Optional[bool]` - :param can_pin_messages: Pass True, if the administrator can pin messages, supergroups only - :type can_pin_messages: :obj:`Optional[bool]` - :param can_promote_members: Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) - :type can_promote_members: :obj:`Optional[bool]` + :param can_restrict_members: Pass True, if the administrator can restrict, ban or unban + chat members + :param can_pin_messages: Pass True, if the administrator can pin messages, supergroups + only + :param can_promote_members: Pass True, if the administrator can add new administrators + with a subset of his own privileges or demote administrators + that he has promoted, directly or indirectly (promoted by + administrators that were appointed by him) :return: Returns True on success. - :rtype: :obj:`bool` """ call = PromoteChatMember( chat_id=chat_id, @@ -1145,77 +1202,83 @@ class Bot(BaseBot): self, chat_id: Union[int, str], permissions: ChatPermissions, ) -> 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 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 admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchatpermissions - :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + (in the format @supergroupusername) :param permissions: New default chat permissions - :type permissions: :obj:`ChatPermissions` :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetChatPermissions(chat_id=chat_id, permissions=permissions,) return await self.emit(call) async def export_chat_invite_link(self, chat_id: Union[int, str],) -> str: """ - Use this method to generate a new invite link for a chat; any previously generated 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. - 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 exportChatInviteLink – after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. + Use this method to generate a new invite link for a chat; any previously generated 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. + 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 exportChatInviteLink – after this the link + will become available to the bot via the getChat method. If your bot needs to generate a + new invite link replacing its previous one, use exportChatInviteLink again. Source: https://core.telegram.org/bots/api#exportchatinvitelink - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :return: Returns the new invite link as String on success. - :rtype: :obj:`str` """ call = ExportChatInviteLink(chat_id=chat_id,) return await self.emit(call) async def set_chat_photo(self, chat_id: Union[int, str], photo: InputFile,) -> 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 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 admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchatphoto - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param photo: New chat photo, uploaded using multipart/form-data - :type photo: :obj:`InputFile` :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetChatPhoto(chat_id=chat_id, photo=photo,) return await self.emit(call) async def delete_chat_photo(self, chat_id: Union[int, str],) -> 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 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 admin + rights. Returns True on success. Source: https://core.telegram.org/bots/api#deletechatphoto - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :return: Returns True on success. - :rtype: :obj:`bool` """ call = DeleteChatPhoto(chat_id=chat_id,) return await self.emit(call) async def set_chat_title(self, chat_id: Union[int, str], title: str,) -> 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 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 admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchattitle - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param title: New chat title, 1-255 characters - :type title: :obj:`str` :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetChatTitle(chat_id=chat_id, title=title,) return await self.emit(call) @@ -1224,16 +1287,16 @@ class Bot(BaseBot): self, chat_id: Union[int, str], description: Optional[str] = None, ) -> 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 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 admin + rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchatdescription - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param description: New chat description, 0-255 characters - :type description: :obj:`Optional[str]` :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetChatDescription(chat_id=chat_id, description=description,) return await self.emit(call) @@ -1245,18 +1308,20 @@ class Bot(BaseBot): disable_notification: Optional[bool] = None, ) -> bool: """ - Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + Use this method to pin a message in a group, a supergroup, or a channel. The bot must be + an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin + right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on + success. Source: https://core.telegram.org/bots/api#pinchatmessage - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param message_id: Identifier of a message to pin - :type message_id: :obj:`int` - :param disable_notification: Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Pass True, if it is not necessary to send a notification to + all chat members about the new pinned message. Notifications + are always disabled in channels. :return: Returns True on success. - :rtype: :obj:`bool` """ call = PinChatMessage( chat_id=chat_id, message_id=message_id, disable_notification=disable_notification, @@ -1265,56 +1330,64 @@ class Bot(BaseBot): async def unpin_chat_message(self, chat_id: Union[int, str],) -> bool: """ - Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be + an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin + right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on + success. Source: https://core.telegram.org/bots/api#unpinchatmessage - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :return: Returns True on success. - :rtype: :obj:`bool` """ call = UnpinChatMessage(chat_id=chat_id,) return await self.emit(call) async def leave_chat(self, chat_id: Union[int, str],) -> bool: """ - Use this method for your bot to leave a group, supergroup or channel. Returns True on success. + Use this method for your bot to leave a group, supergroup or channel. Returns True on + success. Source: https://core.telegram.org/bots/api#leavechat - :param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + or channel (in the format @channelusername) :return: Returns True on success. - :rtype: :obj:`bool` """ call = LeaveChat(chat_id=chat_id,) return await self.emit(call) async def get_chat(self, chat_id: Union[int, str],) -> Chat: """ - Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. + Use this method to get up to date information about the chat (current name of the user for + one-on-one conversations, current username of a user, group or channel, etc.). Returns a + Chat object on success. Source: https://core.telegram.org/bots/api#getchat - :param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + or channel (in the format @channelusername) :return: Returns a Chat object on success. - :rtype: :obj:`Chat` """ call = GetChat(chat_id=chat_id,) return await self.emit(call) async def get_chat_administrators(self, chat_id: Union[int, str],) -> List[ChatMember]: """ - Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. + Use this method to get a list of administrators in a chat. On success, returns an Array of + ChatMember objects that contains information about all chat administrators except other + bots. If the chat is a group or a supergroup and no administrators were appointed, only + the creator will be returned. Source: https://core.telegram.org/bots/api#getchatadministrators - :param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :return: On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. - :rtype: :obj:`List[ChatMember]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + or channel (in the format @channelusername) + :return: On success, returns an Array of ChatMember objects that contains information + about all chat administrators except other bots. If the chat is a group or a + supergroup and no administrators were appointed, only the creator will be + returned. """ call = GetChatAdministrators(chat_id=chat_id,) return await self.emit(call) @@ -1325,56 +1398,59 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#getchatmemberscount - :param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + or channel (in the format @channelusername) :return: Returns Int on success. - :rtype: :obj:`int` """ call = GetChatMembersCount(chat_id=chat_id,) return await self.emit(call) async def get_chat_member(self, chat_id: Union[int, str], user_id: int,) -> ChatMember: """ - Use this method to get information about a member of a chat. Returns a ChatMember object on success. + Use this method to get information about a member of a chat. Returns a ChatMember object + on success. Source: https://core.telegram.org/bots/api#getchatmember - :param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + or channel (in the format @channelusername) :param user_id: Unique identifier of the target user - :type user_id: :obj:`int` :return: Returns a ChatMember object on success. - :rtype: :obj:`ChatMember` """ call = GetChatMember(chat_id=chat_id, user_id=user_id,) return await self.emit(call) async def set_chat_sticker_set(self, chat_id: Union[int, str], sticker_set_name: str,) -> 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 getChat requests to check if the bot can use this method. Returns 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 admin rights. Use + the field can_set_sticker_set optionally returned in getChat requests to check if the bot + can use this method. Returns True on success. Source: https://core.telegram.org/bots/api#setchatstickerset - :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + (in the format @supergroupusername) :param sticker_set_name: Name of the sticker set to be set as the group sticker set - :type sticker_set_name: :obj:`str` - :return: Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. - :rtype: :obj:`bool` + :return: Use the field can_set_sticker_set optionally returned in getChat requests to + check if the bot can use this method. Returns True on success. """ call = SetChatStickerSet(chat_id=chat_id, sticker_set_name=sticker_set_name,) return await self.emit(call) async def delete_chat_sticker_set(self, chat_id: Union[int, str],) -> 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 getChat requests to check if the bot can use this method. Returns 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 admin rights. Use + the field can_set_sticker_set optionally returned in getChat requests to check if the bot + can use this method. Returns True on success. Source: https://core.telegram.org/bots/api#deletechatstickerset - :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - :type chat_id: :obj:`Union[int, str]` - :return: Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. - :rtype: :obj:`bool` + :param chat_id: Unique identifier for the target chat or username of the target supergroup + (in the format @supergroupusername) + :return: Use the field can_set_sticker_set optionally returned in getChat requests to + check if the bot can use this method. Returns True on success. """ call = DeleteChatStickerSet(chat_id=chat_id,) return await self.emit(call) @@ -1388,23 +1464,28 @@ class Bot(BaseBot): cache_time: Optional[int] = None, ) -> bool: """ - Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. - Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. + Use this method to send answers to callback queries sent from inline keyboards. The answer + will be displayed to the user as a notification at the top of the chat screen or as an + alert. On success, True is returned. + Alternatively, the user can be redirected to the specified Game URL. For this option to + work, you must first create a game for your bot via @Botfather and accept the terms. + Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a + parameter. Source: https://core.telegram.org/bots/api#answercallbackquery :param callback_query_id: Unique identifier for the query to be answered - :type callback_query_id: :obj:`str` - :param text: Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters - :type text: :obj:`Optional[str]` - :param show_alert: If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. - :type show_alert: :obj:`Optional[bool]` - :param url: URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. - :type url: :obj:`Optional[str]` - :param cache_time: The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. - :type cache_time: :obj:`Optional[int]` + :param text: Text of the notification. If not specified, nothing will be shown to the + user, 0-200 characters + :param show_alert: If true, an alert will be shown by the client instead of a notification + at the top of the chat screen. Defaults to false. + :param url: URL that will be opened by the user's client. If you have created a Game and + accepted the conditions via @Botfather, specify the URL that opens your game – + note that this will only work if the query comes from a callback_game button. + :param cache_time: The maximum amount of time in seconds that the result of the callback + query may be cached client-side. Telegram apps will support caching + starting in version 3.14. Defaults to 0. :return: On success, True is returned. - :rtype: :obj:`bool` """ call = AnswerCallbackQuery( callback_query_id=callback_query_id, @@ -1431,26 +1512,25 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Union[Message, bool]: """ - Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit text and game messages. On success, if edited message is sent by + the bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagetext :param text: New text of the message - :type text: :obj:`str` - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message to edit - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - :type parse_mode: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message to edit + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in your bot's message. :param disable_web_page_preview: Disables link previews for links in this message - :type disable_web_page_preview: :obj:`Optional[bool]` :param reply_markup: A JSON-serialized object for an inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if edited message is sent by the bot, the edited Message is returned, + otherwise True is returned. """ call = EditMessageText( text=text, @@ -1473,24 +1553,24 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Union[Message, bool]: """ - Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit captions of messages. On success, if edited message is sent by the + bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagecaption - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message to edit - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message to edit + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message :param caption: New caption of the message - :type caption: :obj:`Optional[str]` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - :type parse_mode: :obj:`Optional[str]` + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + fixed-width text or inline URLs in the media caption. :param reply_markup: A JSON-serialized object for an inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if edited message is sent by the bot, the edited Message is returned, + otherwise True is returned. """ call = EditMessageCaption( chat_id=chat_id, @@ -1511,22 +1591,26 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Union[Message, bool]: """ - Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit animation, audio, document, photo, or video messages. If a message + is a part of a message album, then it can be edited only to a photo or a video. Otherwise, + message type can be changed arbitrarily. When inline message is edited, new file can't be + uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if + the edited message was sent by the bot, the edited Message is returned, otherwise True is + returned. Source: https://core.telegram.org/bots/api#editmessagemedia :param media: A JSON-serialized object for a new media content of the message - :type media: :obj:`InputMedia` - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message to edit - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message to edit + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if the edited message was sent by the bot, the edited Message is + returned, otherwise True is returned. """ call = EditMessageMedia( media=media, @@ -1545,20 +1629,21 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Union[Message, bool]: """ - Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit only the reply markup of messages. On success, if edited message + is sent by the bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagereplymarkup - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Optional[Union[int, str]]` - :param message_id: Required if inline_message_id is not specified. Identifier of the message to edit - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat or username of the target channel (in the format + @channelusername) + :param message_id: Required if inline_message_id is not specified. Identifier of the + message to edit + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message :param reply_markup: A JSON-serialized object for an inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` - :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. - :rtype: :obj:`Union[Message, bool]` + :return: On success, if edited message is sent by the bot, the edited Message is returned, + otherwise True is returned. """ call = EditMessageReplyMarkup( chat_id=chat_id, @@ -1575,41 +1660,39 @@ class Bot(BaseBot): reply_markup: Optional[InlineKeyboardMarkup] = None, ) -> Poll: """ - Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. + Use this method to stop a poll which was sent by the bot. On success, the stopped Poll + with the final results is returned. Source: https://core.telegram.org/bots/api#stoppoll - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param message_id: Identifier of the original message with the poll - :type message_id: :obj:`int` :param reply_markup: A JSON-serialized object for a new message inline keyboard. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` :return: On success, the stopped Poll with the final results is returned. - :rtype: :obj:`Poll` """ call = StopPoll(chat_id=chat_id, message_id=message_id, reply_markup=reply_markup,) return await self.emit(call) async def delete_message(self, chat_id: Union[int, str], message_id: int,) -> bool: """ - Use this method to delete a message, including service messages, with the following limitations: + Use this method to delete a message, including service messages, with the following + limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - 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 permission in a supergroup or a channel, it can + delete any message there. Returns True on success. Source: https://core.telegram.org/bots/api#deletemessage - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) :param message_id: Identifier of the message to delete - :type message_id: :obj:`int` :return: Returns True on success. - :rtype: :obj:`bool` """ call = DeleteMessage(chat_id=chat_id, message_id=message_id,) return await self.emit(call) @@ -1630,22 +1713,24 @@ class Bot(BaseBot): ] = None, ) -> Message: """ - Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. + Use this method to send static .WEBP or animated .TGS stickers. On success, the sent + Message is returned. Source: https://core.telegram.org/bots/api#sendsticker - :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) - :type chat_id: :obj:`Union[int, str]` - :param sticker: Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using multipart/form-data. - :type sticker: :obj:`Union[InputFile, str]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param chat_id: Unique identifier for the target chat or username of the target channel + (in the format @channelusername) + :param sticker: Sticker to send. Pass a file_id as String to send a file that exists on + the Telegram servers (recommended), pass an HTTP URL as a String for + Telegram to get a .webp file from the Internet, or upload a new one using + multipart/form-data. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - :type reply_markup: :obj:`Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` + :param reply_markup: Additional interface options. A JSON-serialized object for an inline + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendSticker( chat_id=chat_id, @@ -1663,25 +1748,24 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#getstickerset :param name: Name of the sticker set - :type name: :obj:`str` :return: On success, a StickerSet object is returned. - :rtype: :obj:`StickerSet` """ call = GetStickerSet(name=name,) return await self.emit(call) async def upload_sticker_file(self, user_id: int, png_sticker: InputFile,) -> File: """ - Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. + Use this method to upload a .png file with a sticker for later use in createNewStickerSet + and addStickerToSet methods (can be used multiple times). Returns the uploaded File on + success. Source: https://core.telegram.org/bots/api#uploadstickerfile :param user_id: User identifier of sticker file owner - :type user_id: :obj:`int` - :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. - :type png_sticker: :obj:`InputFile` + :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, + dimensions must not exceed 512px, and either width or height must be + exactly 512px. :return: Returns the uploaded File on success. - :rtype: :obj:`File` """ call = UploadStickerFile(user_id=user_id, png_sticker=png_sticker,) return await self.emit(call) @@ -1697,26 +1781,28 @@ class Bot(BaseBot): mask_position: Optional[MaskPosition] = None, ) -> bool: """ - Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. + Use this method to create new sticker set owned by a user. The bot will be able to edit + the created sticker set. Returns True on success. Source: https://core.telegram.org/bots/api#createnewstickerset :param user_id: User identifier of created sticker set owner - :type user_id: :obj:`int` - :param name: Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in '_by_'. is case insensitive. 1-64 characters. - :type name: :obj:`str` + :param name: Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., + animals). Can contain only english letters, digits and underscores. Must + begin with a letter, can't contain consecutive underscores and must end in + '_by_'. is case insensitive. 1-64 characters. :param title: Sticker set title, 1-64 characters - :type title: :obj:`str` - :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. - :type png_sticker: :obj:`Union[InputFile, str]` + :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, + dimensions must not exceed 512px, and either width or height must be + exactly 512px. Pass a file_id as a String to send a file that already + exists on the Telegram servers, pass an HTTP URL as a String for + Telegram to get a file from the Internet, or upload a new one using + multipart/form-data. :param emojis: One or more emoji corresponding to the sticker - :type emojis: :obj:`str` :param contains_masks: Pass True, if a set of mask stickers should be created - :type contains_masks: :obj:`Optional[bool]` - :param mask_position: A JSON-serialized object for position where the mask should be placed on faces - :type mask_position: :obj:`Optional[MaskPosition]` + :param mask_position: A JSON-serialized object for position where the mask should be + placed on faces :return: Returns True on success. - :rtype: :obj:`bool` """ call = CreateNewStickerSet( user_id=user_id, @@ -1743,17 +1829,17 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#addstickertoset :param user_id: User identifier of sticker set owner - :type user_id: :obj:`int` :param name: Sticker set name - :type name: :obj:`str` - :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. - :type png_sticker: :obj:`Union[InputFile, str]` + :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, + dimensions must not exceed 512px, and either width or height must be + exactly 512px. Pass a file_id as a String to send a file that already + exists on the Telegram servers, pass an HTTP URL as a String for + Telegram to get a file from the Internet, or upload a new one using + multipart/form-data. :param emojis: One or more emoji corresponding to the sticker - :type emojis: :obj:`str` - :param mask_position: A JSON-serialized object for position where the mask should be placed on faces - :type mask_position: :obj:`Optional[MaskPosition]` + :param mask_position: A JSON-serialized object for position where the mask should be + placed on faces :return: Returns True on success. - :rtype: :obj:`bool` """ call = AddStickerToSet( user_id=user_id, @@ -1766,30 +1852,27 @@ class Bot(BaseBot): async def set_sticker_position_in_set(self, sticker: str, position: int,) -> bool: """ - Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. + Use this method to move a sticker in a set created by the bot to a specific position . + Returns True on success. Source: https://core.telegram.org/bots/api#setstickerpositioninset :param sticker: File identifier of the sticker - :type sticker: :obj:`str` :param position: New sticker position in the set, zero-based - :type position: :obj:`int` :return: Returns True on success. - :rtype: :obj:`bool` """ call = SetStickerPositionInSet(sticker=sticker, position=position,) return await self.emit(call) async def delete_sticker_from_set(self, sticker: str,) -> bool: """ - Use this method to delete a sticker from a set created by the bot. Returns True on success. + Use this method to delete a sticker from a set created by the bot. Returns True on + success. Source: https://core.telegram.org/bots/api#deletestickerfromset :param sticker: File identifier of the sticker - :type sticker: :obj:`str` :return: Returns True on success. - :rtype: :obj:`bool` """ call = DeleteStickerFromSet(sticker=sticker,) return await self.emit(call) @@ -1816,21 +1899,23 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#answerinlinequery :param inline_query_id: Unique identifier for the answered query - :type inline_query_id: :obj:`str` :param results: A JSON-serialized array of results for the inline query - :type results: :obj:`List[InlineQueryResult]` - :param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. - :type cache_time: :obj:`Optional[int]` - :param is_personal: Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query - :type is_personal: :obj:`Optional[bool]` - :param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. - :type next_offset: :obj:`Optional[str]` - :param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter - :type switch_pm_text: :obj:`Optional[str]` - :param switch_pm_parameter: Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. - :type switch_pm_parameter: :obj:`Optional[str]` + :param cache_time: The maximum amount of time in seconds that the result of the inline + query may be cached on the server. Defaults to 300. + :param is_personal: Pass True, if results may be cached on the server side only for the + user that sent the query. By default, results may be returned to any + user who sends the same query + :param next_offset: Pass the offset that a client should send in the next query with the + same text to receive more results. Pass an empty string if there are + no more results or if you don‘t support pagination. Offset length + can’t exceed 64 bytes. + :param switch_pm_text: If passed, clients will display a button with specified text that + switches the user to a private chat with the bot and sends the bot + a start message with the parameter switch_pm_parameter + :param switch_pm_parameter: Deep-linking parameter for the /start message sent to the bot + when user presses the switch button. 1-64 characters, only + A-Z, a-z, 0-9, _ and - are allowed. :return: On success, True is returned. - :rtype: :obj:`bool` """ call = AnswerInlineQuery( inline_query_id=inline_query_id, @@ -1880,53 +1965,44 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendinvoice :param chat_id: Unique identifier for the target private chat - :type chat_id: :obj:`int` :param title: Product name, 1-32 characters - :type title: :obj:`str` :param description: Product description, 1-255 characters - :type description: :obj:`str` - :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - :type payload: :obj:`str` + :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to + the user, use for your internal processes. :param provider_token: Payments provider token, obtained via Botfather - :type provider_token: :obj:`str` - :param start_parameter: Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter - :type start_parameter: :obj:`str` + :param start_parameter: Unique deep-linking parameter that can be used to generate this + invoice when used as a start parameter :param currency: Three-letter ISO 4217 currency code, see more on currencies - :type currency: :obj:`str` - :param prices: Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - :type prices: :obj:`List[LabeledPrice]` - :param provider_data: JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. - :type provider_data: :obj:`Optional[str]` - :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. - :type photo_url: :obj:`Optional[str]` + :param prices: Price breakdown, a list of components (e.g. product price, tax, discount, + delivery cost, delivery tax, bonus, etc.) + :param provider_data: JSON-encoded data about the invoice, which will be shared with the + payment provider. A detailed description of required fields should + be provided by the payment provider. + :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or + a marketing image for a service. People like it better when they see + what they are paying for. :param photo_size: Photo size - :type photo_size: :obj:`Optional[int]` :param photo_width: Photo width - :type photo_width: :obj:`Optional[int]` :param photo_height: Photo height - :type photo_height: :obj:`Optional[int]` :param need_name: Pass True, if you require the user's full name to complete the order - :type need_name: :obj:`Optional[bool]` - :param need_phone_number: Pass True, if you require the user's phone number to complete the order - :type need_phone_number: :obj:`Optional[bool]` - :param need_email: Pass True, if you require the user's email address to complete the order - :type need_email: :obj:`Optional[bool]` - :param need_shipping_address: Pass True, if you require the user's shipping address to complete the order - :type need_shipping_address: :obj:`Optional[bool]` - :param send_phone_number_to_provider: Pass True, if user's phone number should be sent to provider - :type send_phone_number_to_provider: :obj:`Optional[bool]` - :param send_email_to_provider: Pass True, if user's email address should be sent to provider - :type send_email_to_provider: :obj:`Optional[bool]` + :param need_phone_number: Pass True, if you require the user's phone number to complete + the order + :param need_email: Pass True, if you require the user's email address to complete the + order + :param need_shipping_address: Pass True, if you require the user's shipping address to + complete the order + :param send_phone_number_to_provider: Pass True, if user's phone number should be sent to + provider + :param send_email_to_provider: Pass True, if user's email address should be sent to + provider :param is_flexible: Pass True, if the final price depends on the shipping method - :type is_flexible: :obj:`Optional[bool]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` + :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Pay + total price' button will be shown. If not empty, the first button + must be a Pay button. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendInvoice( chat_id=chat_id, @@ -1963,20 +2039,23 @@ class Bot(BaseBot): error_message: Optional[str] = None, ) -> bool: """ - If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an 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 Update with a shipping_query field to the bot. Use + this method to reply to shipping queries. On success, True is returned. Source: https://core.telegram.org/bots/api#answershippingquery :param shipping_query_id: Unique identifier for the query to be answered - :type shipping_query_id: :obj:`str` - :param ok: 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) - :type ok: :obj:`bool` - :param shipping_options: Required if ok is True. A JSON-serialized array of available shipping options. - :type shipping_options: :obj:`Optional[List[ShippingOption]]` - :param error_message: 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. - :type error_message: :obj:`Optional[str]` + :param ok: 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) + :param shipping_options: Required if ok is True. A JSON-serialized array of available + shipping options. + :param error_message: 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. :return: On success, True is returned. - :rtype: :obj:`bool` """ call = AnswerShippingQuery( shipping_query_id=shipping_query_id, @@ -1990,18 +2069,23 @@ class Bot(BaseBot): self, pre_checkout_query_id: str, ok: bool, error_message: Optional[str] = None, ) -> bool: """ - Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an 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 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. Source: https://core.telegram.org/bots/api#answerprecheckoutquery :param pre_checkout_query_id: Unique identifier for the query to be answered - :type pre_checkout_query_id: :obj:`str` - :param ok: Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. - :type ok: :obj:`bool` - :param error_message: Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. - :type error_message: :obj:`Optional[str]` + :param ok: Specify True if everything is alright (goods are available, etc.) and the bot + is ready to proceed with the order. Use False if there are any problems. + :param error_message: Required if ok is False. Error message in human readable form that + explains the reason for failure to proceed with the checkout (e.g. + "Sorry, somebody just bought the last of our amazing black T-shirts + while you were busy filling out your payment details. Please choose + a different color or garment!"). Telegram will display this message + to the user. :return: On success, True is returned. - :rtype: :obj:`bool` """ call = AnswerPreCheckoutQuery( pre_checkout_query_id=pre_checkout_query_id, ok=ok, error_message=error_message, @@ -2017,17 +2101,22 @@ class Bot(BaseBot): self, user_id: int, errors: List[PassportElementError], ) -> bool: """ - Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. - Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. + Informs a user that some of the Telegram Passport elements they provided contains errors. + The user will not be able to re-submit their Passport to you until the errors are fixed + (the contents of the field for which you returned the error must change). Returns True on + success. + Use this if the data submitted by the user doesn't satisfy the standards your service + requires for any reason. For example, if a birthday date seems invalid, a submitted + document is blurry, a scan shows evidence of tampering, etc. Supply some details in the + error message to make sure the user knows how to correct the issues. Source: https://core.telegram.org/bots/api#setpassportdataerrors :param user_id: User identifier - :type user_id: :obj:`int` :param errors: A JSON-serialized array describing the errors - :type errors: :obj:`List[PassportElementError]` - :return: The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. - :rtype: :obj:`bool` + :return: The user will not be able to re-submit their Passport to you until the errors are + fixed (the contents of the field for which you returned the error must change). + Returns True on success. """ call = SetPassportDataErrors(user_id=user_id, errors=errors,) return await self.emit(call) @@ -2051,17 +2140,15 @@ class Bot(BaseBot): Source: https://core.telegram.org/bots/api#sendgame :param chat_id: Unique identifier for the target chat - :type chat_id: :obj:`int` - :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. - :type game_short_name: :obj:`str` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. - :type disable_notification: :obj:`Optional[bool]` + :param game_short_name: Short name of the game, serves as the unique identifier for the + game. Set up your games via Botfather. + :param disable_notification: Sends the message silently. Users will receive a notification + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message - :type reply_to_message_id: :obj:`Optional[int]` - :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game. - :type reply_markup: :obj:`Optional[InlineKeyboardMarkup]` + :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one ‘Play + game_title’ button will be shown. If not empty, the first button must + launch the game. :return: On success, the sent Message is returned. - :rtype: :obj:`Message` """ call = SendGame( chat_id=chat_id, @@ -2083,26 +2170,28 @@ class Bot(BaseBot): inline_message_id: Optional[str] = None, ) -> 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 Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. + 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 Message, otherwise returns True. Returns + an error, if the new score is not greater than the user's current score in the chat and + force is False. Source: https://core.telegram.org/bots/api#setgamescore :param user_id: User identifier - :type user_id: :obj:`int` :param score: New score, must be non-negative - :type score: :obj:`int` - :param force: Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - :type force: :obj:`Optional[bool]` - :param disable_edit_message: Pass True, if the game message should not be automatically edited to include the current scoreboard - :type disable_edit_message: :obj:`Optional[bool]` - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat - :type chat_id: :obj:`Optional[int]` - :param message_id: Required if inline_message_id is not specified. Identifier of the sent message - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` - :return: On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. - :rtype: :obj:`Union[Message, bool]` + :param force: Pass True, if the high score is allowed to decrease. This can be useful when + fixing mistakes or banning cheaters + :param disable_edit_message: Pass True, if the game message should not be automatically + edited to include the current scoreboard + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat + :param message_id: Required if inline_message_id is not specified. Identifier of the sent + message + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message + :return: On success, if the message was sent by the bot, returns the edited Message, + otherwise returns True. Returns an error, if the new score is not greater than + the user's current score in the chat and force is False. """ call = SetGameScore( user_id=user_id, @@ -2123,21 +2212,27 @@ class Bot(BaseBot): inline_message_id: Optional[str] = None, ) -> List[GameHighScore]: """ - Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. - This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. + Use this method to get data for high score tables. Will return the score of the specified + user and several of his neighbors in a game. On success, returns an Array of GameHighScore + objects. + This method will currently return scores for the target user, plus two of his closest + neighbors on each side. Will also return the top three users if the user and his neighbors + are not among them. Please note that this behavior is subject to change. Source: https://core.telegram.org/bots/api#getgamehighscores :param user_id: Target user id - :type user_id: :obj:`int` - :param chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat - :type chat_id: :obj:`Optional[int]` - :param message_id: Required if inline_message_id is not specified. Identifier of the sent message - :type message_id: :obj:`Optional[int]` - :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :type inline_message_id: :obj:`Optional[str]` - :return: Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. - :rtype: :obj:`List[GameHighScore]` + :param chat_id: Required if inline_message_id is not specified. Unique identifier for the + target chat + :param message_id: Required if inline_message_id is not specified. Identifier of the sent + message + :param inline_message_id: Required if chat_id and message_id are not specified. Identifier + of the inline message + :return: Will return the score of the specified user and several of his neighbors in a + game. On success, returns an Array of GameHighScore objects. This method will + currently return scores for the target user, plus two of his closest neighbors on + each side. Will also return the top three users if the user and his neighbors are + not among them. """ call = GetGameHighScores( user_id=user_id, diff --git a/aiogram/api/methods/add_sticker_to_set.py b/aiogram/api/methods/add_sticker_to_set.py index b0268fcf..6da6060d 100644 --- a/aiogram/api/methods/add_sticker_to_set.py +++ b/aiogram/api/methods/add_sticker_to_set.py @@ -15,16 +15,15 @@ class AddStickerToSet(TelegramMethod[bool]): user_id: int """User identifier of sticker set owner""" - name: str """Sticker set name""" - png_sticker: Union[InputFile, str] - """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" - + """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed + 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send + a file that already exists on the Telegram servers, pass an HTTP URL as a String for + Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" emojis: str """One or more emoji corresponding to the sticker""" - mask_position: Optional[MaskPosition] = None """A JSON-serialized object for position where the mask should be placed on faces""" diff --git a/aiogram/api/methods/answer_callback_query.py b/aiogram/api/methods/answer_callback_query.py index 17fa6965..23346b73 100644 --- a/aiogram/api/methods/answer_callback_query.py +++ b/aiogram/api/methods/answer_callback_query.py @@ -5,8 +5,12 @@ from .base import Request, TelegramMethod class AnswerCallbackQuery(TelegramMethod[bool]): """ - Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. - Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. + Use this method to send answers to callback queries sent from inline keyboards. The answer + will be displayed to the user as a notification at the top of the chat screen or as an alert. + On success, True is returned. + Alternatively, the user can be redirected to the specified Game URL. For this option to work, + you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you + may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. Source: https://core.telegram.org/bots/api#answercallbackquery """ @@ -15,20 +19,19 @@ class AnswerCallbackQuery(TelegramMethod[bool]): callback_query_id: str """Unique identifier for the query to be answered""" - text: Optional[str] = None - """Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters""" - + """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 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 Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. - - Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.""" - + """URL that will be opened by the user's client. If you have created a Game and accepted the + conditions via @Botfather, specify the URL that opens your game – note that this will only + work if the query comes from a callback_game button.""" cache_time: Optional[int] = None - """The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.""" + """The maximum amount of time in seconds that the result of the callback query may be cached + client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/answer_inline_query.py b/aiogram/api/methods/answer_inline_query.py index 75141da5..34f70962 100644 --- a/aiogram/api/methods/answer_inline_query.py +++ b/aiogram/api/methods/answer_inline_query.py @@ -16,26 +16,25 @@ class AnswerInlineQuery(TelegramMethod[bool]): inline_query_id: str """Unique identifier for the answered query""" - results: List[InlineQueryResult] """A JSON-serialized array of results for the inline query""" - cache_time: Optional[int] = None - """The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.""" - + """The maximum amount of time in seconds that the result of the inline query may be cached on + the server. Defaults to 300.""" is_personal: Optional[bool] = None - """Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query""" - + """Pass True, if results may be cached on the server side only for the user that sent the + query. By default, results may be returned to any user who sends the same query""" next_offset: Optional[str] = None - """Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.""" - + """Pass the offset that a client should send in the next query with the same text to receive + more results. Pass an empty string if there are no more results or if you don‘t support + pagination. Offset length can’t exceed 64 bytes.""" switch_pm_text: Optional[str] = None - """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter""" - + """If passed, clients will display a button with specified text that switches the user to a + private chat with the bot and sends the bot a start message with the parameter + switch_pm_parameter""" switch_pm_parameter: Optional[str] = None - """Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. - - Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a ‘Connect your YouTube account’ button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.""" + """Deep-linking parameter for the /start message sent to the bot when user presses the switch + button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/answer_pre_checkout_query.py b/aiogram/api/methods/answer_pre_checkout_query.py index 8905923e..fae21d5c 100644 --- a/aiogram/api/methods/answer_pre_checkout_query.py +++ b/aiogram/api/methods/answer_pre_checkout_query.py @@ -5,7 +5,10 @@ from .base import Request, TelegramMethod 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 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 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. Source: https://core.telegram.org/bots/api#answerprecheckoutquery """ @@ -14,12 +17,14 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]): pre_checkout_query_id: str """Unique identifier for the query to be answered""" - ok: bool - """Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.""" - + """Specify True if everything is alright (goods are available, etc.) and the bot is ready to + proceed with the order. Use False if there are any problems.""" error_message: Optional[str] = None - """Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.""" + """Required if ok is False. Error message in human readable form that explains the reason for + failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our + amazing black T-shirts while you were busy filling out your payment details. Please choose + a different color or garment!"). Telegram will display this message to the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/answer_shipping_query.py b/aiogram/api/methods/answer_shipping_query.py index 7015426f..986d8fe6 100644 --- a/aiogram/api/methods/answer_shipping_query.py +++ b/aiogram/api/methods/answer_shipping_query.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod 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 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 Update with a shipping_query field to the bot. Use this + method to reply to shipping queries. On success, True is returned. Source: https://core.telegram.org/bots/api#answershippingquery """ @@ -15,15 +17,15 @@ 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 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.""" - 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.""" + """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.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/create_new_sticker_set.py b/aiogram/api/methods/create_new_sticker_set.py index cbe95396..9545c302 100644 --- a/aiogram/api/methods/create_new_sticker_set.py +++ b/aiogram/api/methods/create_new_sticker_set.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class CreateNewStickerSet(TelegramMethod[bool]): """ - Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. + Use this method to create new sticker set owned by a user. The bot will be able to edit the + created sticker set. Returns True on success. Source: https://core.telegram.org/bots/api#createnewstickerset """ @@ -15,22 +16,22 @@ class CreateNewStickerSet(TelegramMethod[bool]): user_id: int """User identifier of created sticker set owner""" - name: str - """Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in '_by_'. is case insensitive. 1-64 characters.""" - + """Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can + contain only english letters, digits and underscores. Must begin with a letter, can't + contain consecutive underscores and must end in '_by_'. is + case insensitive. 1-64 characters.""" title: str """Sticker set title, 1-64 characters""" - png_sticker: Union[InputFile, str] - """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" - + """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed + 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send + a file that already exists on the Telegram servers, pass an HTTP URL as a String for + Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" emojis: str """One or more emoji corresponding to the sticker""" - contains_masks: Optional[bool] = None """Pass True, if a set of mask stickers should be created""" - mask_position: Optional[MaskPosition] = None """A JSON-serialized object for position where the mask should be placed on faces""" diff --git a/aiogram/api/methods/delete_chat_photo.py b/aiogram/api/methods/delete_chat_photo.py index bff8eb12..dc9e075c 100644 --- a/aiogram/api/methods/delete_chat_photo.py +++ b/aiogram/api/methods/delete_chat_photo.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod 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 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 admin + rights. Returns True on success. Source: https://core.telegram.org/bots/api#deletechatphoto """ @@ -13,7 +15,8 @@ class DeleteChatPhoto(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/delete_chat_sticker_set.py b/aiogram/api/methods/delete_chat_sticker_set.py index aac1de11..45d473c0 100644 --- a/aiogram/api/methods/delete_chat_sticker_set.py +++ b/aiogram/api/methods/delete_chat_sticker_set.py @@ -5,7 +5,10 @@ from .base import Request, TelegramMethod 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 getChat requests to check if the bot can use this method. Returns 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 admin rights. Use the + field can_set_sticker_set optionally returned in getChat requests to check if the bot can use + this method. Returns True on success. Source: https://core.telegram.org/bots/api#deletechatstickerset """ @@ -13,7 +16,8 @@ class DeleteChatStickerSet(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" + """Unique identifier for the target chat or username of the target supergroup (in the format + @supergroupusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/delete_message.py b/aiogram/api/methods/delete_message.py index a086b93f..7032ad61 100644 --- a/aiogram/api/methods/delete_message.py +++ b/aiogram/api/methods/delete_message.py @@ -5,13 +5,15 @@ from .base import Request, TelegramMethod class DeleteMessage(TelegramMethod[bool]): """ - Use this method to delete a message, including service messages, with the following limitations: + Use this method to delete a message, including service messages, with the following + limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - 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 permission in a supergroup or a channel, it can delete + any message there. Returns True on success. Source: https://core.telegram.org/bots/api#deletemessage @@ -20,8 +22,8 @@ class DeleteMessage(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" message_id: int """Identifier of the message to delete""" diff --git a/aiogram/api/methods/delete_webhook.py b/aiogram/api/methods/delete_webhook.py index bef29c74..0783974e 100644 --- a/aiogram/api/methods/delete_webhook.py +++ b/aiogram/api/methods/delete_webhook.py @@ -5,7 +5,8 @@ from .base import Request, TelegramMethod class DeleteWebhook(TelegramMethod[bool]): """ - Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. + Use this method to remove webhook integration if you decide to switch back to getUpdates. + Returns True on success. Requires no parameters. Source: https://core.telegram.org/bots/api#deletewebhook """ diff --git a/aiogram/api/methods/edit_message_caption.py b/aiogram/api/methods/edit_message_caption.py index 38f046d0..3ffd5450 100644 --- a/aiogram/api/methods/edit_message_caption.py +++ b/aiogram/api/methods/edit_message_caption.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class EditMessageCaption(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit captions of messages. On success, if edited message is sent by the + bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagecaption """ @@ -14,20 +15,17 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] chat_id: Optional[Union[int, str]] = None - """Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Required if inline_message_id is not specified. Unique identifier for the target chat or + username of the target channel (in the format @channelusername)""" message_id: Optional[int] = None """Required if inline_message_id is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" - caption: Optional[str] = None """New caption of the message""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for an inline keyboard.""" diff --git a/aiogram/api/methods/edit_message_live_location.py b/aiogram/api/methods/edit_message_live_location.py index a12ea60b..ca54c11e 100644 --- a/aiogram/api/methods/edit_message_live_location.py +++ b/aiogram/api/methods/edit_message_live_location.py @@ -6,7 +6,10 @@ from .base import Request, TelegramMethod class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit live location messages. A location can be edited until its live_period + expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if + the edited message was sent by the bot, the edited Message is returned, otherwise True is + returned. Source: https://core.telegram.org/bots/api#editmessagelivelocation """ @@ -15,19 +18,15 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): latitude: float """Latitude of new location""" - longitude: float """Longitude of new location""" - chat_id: Optional[Union[int, str]] = None - """Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Required if inline_message_id is not specified. Unique identifier for the target chat or + username of the target channel (in the format @channelusername)""" message_id: Optional[int] = None """Required if inline_message_id is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for a new inline keyboard.""" diff --git a/aiogram/api/methods/edit_message_media.py b/aiogram/api/methods/edit_message_media.py index dead0e52..ae2c2829 100644 --- a/aiogram/api/methods/edit_message_media.py +++ b/aiogram/api/methods/edit_message_media.py @@ -1,8 +1,7 @@ -import secrets from typing import Any, Dict, Optional, Union +from ..types import InlineKeyboardMarkup, InputFile, Message from .base import Request, TelegramMethod -from ..types import InlineKeyboardMarkup, InputMedia, Message, InputFile class EditMessageMedia(TelegramMethod[Union[Message, bool]]): @@ -14,7 +13,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] - media: InputMedia + media: Union[str, InputFile] """A JSON-serialized object for a new media content of the message""" chat_id: Optional[Union[int, str]] = None diff --git a/aiogram/api/methods/edit_message_reply_markup.py b/aiogram/api/methods/edit_message_reply_markup.py index 04d79354..49dec7fc 100644 --- a/aiogram/api/methods/edit_message_reply_markup.py +++ b/aiogram/api/methods/edit_message_reply_markup.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit only the reply markup of messages. On success, if edited message is + sent by the bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagereplymarkup """ @@ -14,14 +15,12 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] chat_id: Optional[Union[int, str]] = None - """Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Required if inline_message_id is not specified. Unique identifier for the target chat or + username of the target channel (in the format @channelusername)""" message_id: Optional[int] = None """Required if inline_message_id is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for an inline keyboard.""" diff --git a/aiogram/api/methods/edit_message_text.py b/aiogram/api/methods/edit_message_text.py index c0b0a18f..8306ff06 100644 --- a/aiogram/api/methods/edit_message_text.py +++ b/aiogram/api/methods/edit_message_text.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class EditMessageText(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + Use this method to edit text and game messages. On success, if edited message is sent by the + bot, the edited Message is returned, otherwise True is returned. Source: https://core.telegram.org/bots/api#editmessagetext """ @@ -15,22 +16,18 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): text: str """New text of the message""" - chat_id: Optional[Union[int, str]] = None - """Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Required if inline_message_id is not specified. Unique identifier for the target chat or + username of the target channel (in the format @channelusername)""" message_id: Optional[int] = None """Required if inline_message_id is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in your bot's message.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in this message""" - reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for an inline keyboard.""" diff --git a/aiogram/api/methods/export_chat_invite_link.py b/aiogram/api/methods/export_chat_invite_link.py index 47d8118c..7d4fc267 100644 --- a/aiogram/api/methods/export_chat_invite_link.py +++ b/aiogram/api/methods/export_chat_invite_link.py @@ -5,8 +5,14 @@ from .base import Request, TelegramMethod class ExportChatInviteLink(TelegramMethod[str]): """ - Use this method to generate a new invite link for a chat; any previously generated 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. - 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 exportChatInviteLink – after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. + Use this method to generate a new invite link for a chat; any previously generated 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. + 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 exportChatInviteLink – after this the link will + become available to the bot via the getChat method. If your bot needs to generate a new invite + link replacing its previous one, use exportChatInviteLink again. Source: https://core.telegram.org/bots/api#exportchatinvitelink """ @@ -14,7 +20,8 @@ class ExportChatInviteLink(TelegramMethod[str]): __returning__ = str chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/forward_message.py b/aiogram/api/methods/forward_message.py index bcd9e5d3..d8082704 100644 --- a/aiogram/api/methods/forward_message.py +++ b/aiogram/api/methods/forward_message.py @@ -14,14 +14,13 @@ class ForwardMessage(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" from_chat_id: Union[int, str] - """Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)""" - + """Unique identifier for the chat where the original message was sent (or channel username in + the format @channelusername)""" message_id: int """Message identifier in the chat specified in from_chat_id""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" diff --git a/aiogram/api/methods/get_chat.py b/aiogram/api/methods/get_chat.py index 2b796d8a..be1fe55d 100644 --- a/aiogram/api/methods/get_chat.py +++ b/aiogram/api/methods/get_chat.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod class GetChat(TelegramMethod[Chat]): """ - Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. + Use this method to get up to date information about the chat (current name of the user for + one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat + object on success. Source: https://core.telegram.org/bots/api#getchat """ @@ -14,7 +16,8 @@ class GetChat(TelegramMethod[Chat]): __returning__ = Chat chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target supergroup or channel (in + the format @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/get_chat_administrators.py b/aiogram/api/methods/get_chat_administrators.py index bfb32509..75398f82 100644 --- a/aiogram/api/methods/get_chat_administrators.py +++ b/aiogram/api/methods/get_chat_administrators.py @@ -6,7 +6,10 @@ from .base import Request, TelegramMethod class GetChatAdministrators(TelegramMethod[List[ChatMember]]): """ - Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. + Use this method to get a list of administrators in a chat. On success, returns an Array of + ChatMember objects that contains information about all chat administrators except other bots. + If the chat is a group or a supergroup and no administrators were appointed, only the creator + will be returned. Source: https://core.telegram.org/bots/api#getchatadministrators """ @@ -14,7 +17,8 @@ class GetChatAdministrators(TelegramMethod[List[ChatMember]]): __returning__ = List[ChatMember] chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target supergroup or channel (in + the format @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/get_chat_member.py b/aiogram/api/methods/get_chat_member.py index 5b08d309..69a1c6a3 100644 --- a/aiogram/api/methods/get_chat_member.py +++ b/aiogram/api/methods/get_chat_member.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class GetChatMember(TelegramMethod[ChatMember]): """ - Use this method to get information about a member of a chat. Returns a ChatMember object on success. + Use this method to get information about a member of a chat. Returns a ChatMember object on + success. Source: https://core.telegram.org/bots/api#getchatmember """ @@ -14,8 +15,8 @@ class GetChatMember(TelegramMethod[ChatMember]): __returning__ = ChatMember chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target supergroup or channel (in + the format @channelusername)""" user_id: int """Unique identifier of the target user""" diff --git a/aiogram/api/methods/get_chat_members_count.py b/aiogram/api/methods/get_chat_members_count.py index 91d162cc..50b4f484 100644 --- a/aiogram/api/methods/get_chat_members_count.py +++ b/aiogram/api/methods/get_chat_members_count.py @@ -13,7 +13,8 @@ class GetChatMembersCount(TelegramMethod[int]): __returning__ = int chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target supergroup or channel (in + the format @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/get_file.py b/aiogram/api/methods/get_file.py index 5cfe2a97..f39f2ebf 100644 --- a/aiogram/api/methods/get_file.py +++ b/aiogram/api/methods/get_file.py @@ -6,8 +6,13 @@ from .base import Request, TelegramMethod class GetFile(TelegramMethod[File]): """ - Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. - Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. + Use this method to get basic info about a file and prepare it for downloading. For the moment, + bots can download files of up to 20MB in size. On success, a File object is returned. The file + can then be downloaded via the link https://api.telegram.org/file/bot/, + where is taken from the response. It is guaranteed that the link will be valid for + at least 1 hour. When the link expires, a new one can be requested by calling getFile again. + Note: This function may not preserve the original file name and MIME type. You should save the + file's MIME type and name (if available) when the File object is received. Source: https://core.telegram.org/bots/api#getfile """ diff --git a/aiogram/api/methods/get_game_high_scores.py b/aiogram/api/methods/get_game_high_scores.py index e1e956e2..9e832f61 100644 --- a/aiogram/api/methods/get_game_high_scores.py +++ b/aiogram/api/methods/get_game_high_scores.py @@ -6,8 +6,11 @@ from .base import Request, TelegramMethod class GetGameHighScores(TelegramMethod[List[GameHighScore]]): """ - Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. - This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. + Use this method to get data for high score tables. Will return the score of the specified user + and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. + This method will currently return scores for the target user, plus two of his closest + neighbors on each side. Will also return the top three users if the user and his neighbors are + not among them. Please note that this behavior is subject to change. Source: https://core.telegram.org/bots/api#getgamehighscores """ @@ -16,13 +19,10 @@ class GetGameHighScores(TelegramMethod[List[GameHighScore]]): user_id: int """Target user id""" - chat_id: Optional[int] = None """Required if inline_message_id is not specified. Unique identifier for the target chat""" - message_id: Optional[int] = None """Required if inline_message_id is not specified. Identifier of the sent message""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" diff --git a/aiogram/api/methods/get_me.py b/aiogram/api/methods/get_me.py index 94801147..f12f75fc 100644 --- a/aiogram/api/methods/get_me.py +++ b/aiogram/api/methods/get_me.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod 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 User object. + A simple method for testing your bot's auth token. Requires no parameters. Returns basic + information about the bot in form of a User object. Source: https://core.telegram.org/bots/api#getme """ diff --git a/aiogram/api/methods/get_updates.py b/aiogram/api/methods/get_updates.py index cf262bd9..d1e9e5e8 100644 --- a/aiogram/api/methods/get_updates.py +++ b/aiogram/api/methods/get_updates.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class GetUpdates(TelegramMethod[List[Update]]): """ - Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. + Use this method to receive incoming updates using long polling (wiki). An Array of Update + objects is returned. Notes 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response. @@ -17,18 +18,23 @@ class GetUpdates(TelegramMethod[List[Update]]): __returning__ = List[Update] offset: Optional[int] = None - """Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.""" - + """Identifier of the first update to be returned. Must be greater by one than the highest + among the identifiers of previously received updates. By default, updates starting with the + earliest unconfirmed update are returned. An update is considered confirmed as soon as + getUpdates is called with an offset higher than its update_id. The negative offset can be + specified to retrieve updates starting from -offset update from the end of the updates + queue. All previous updates will forgotten.""" limit: Optional[int] = None - """Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.""" - + """Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults + to 100.""" timeout: Optional[int] = None - """Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.""" - + """Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be + positive, short polling should be used for testing purposes only.""" allowed_updates: Optional[List[str]] = None - """List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. - - Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.""" + """List the types of updates you want your bot to receive. For example, specify ['message', + 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update + for a complete list of available update types. Specify an empty list to receive all updates + regardless of type (default). If not specified, the previous setting will be used.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/get_user_profile_photos.py b/aiogram/api/methods/get_user_profile_photos.py index fef4698e..0a0c33d9 100644 --- a/aiogram/api/methods/get_user_profile_photos.py +++ b/aiogram/api/methods/get_user_profile_photos.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): """ - Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. + Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos + object. Source: https://core.telegram.org/bots/api#getuserprofilephotos """ @@ -15,12 +16,11 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): user_id: int """Unique identifier of the target user""" - offset: Optional[int] = None """Sequential number of the first photo to be returned. By default, all photos are returned.""" - limit: Optional[int] = None - """Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.""" + """Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to + 100.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/get_webhook_info.py b/aiogram/api/methods/get_webhook_info.py index 75776a91..8a147162 100644 --- a/aiogram/api/methods/get_webhook_info.py +++ b/aiogram/api/methods/get_webhook_info.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod class GetWebhookInfo(TelegramMethod[WebhookInfo]): """ - Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. + Use this method to get current webhook status. Requires no parameters. On success, returns a + WebhookInfo object. If the bot is using getUpdates, will return an object with the url field + empty. Source: https://core.telegram.org/bots/api#getwebhookinfo """ diff --git a/aiogram/api/methods/kick_chat_member.py b/aiogram/api/methods/kick_chat_member.py index a64a36c7..90cb50cf 100644 --- a/aiogram/api/methods/kick_chat_member.py +++ b/aiogram/api/methods/kick_chat_member.py @@ -6,7 +6,10 @@ from .base import Request, TelegramMethod class KickChatMember(TelegramMethod[bool]): """ - Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. + Use this method to kick a user from a group, a supergroup or a channel. In the case of + supergroups and channels, the user will not be able to return to the group on their own using + invite links, etc., unless unbanned first. The bot must be an administrator in the chat for + this to work and must have the appropriate admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#kickchatmember """ @@ -14,13 +17,13 @@ class KickChatMember(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)""" - + """Unique identifier for the target group or username of the target supergroup or channel (in + the format @channelusername)""" user_id: int """Unique identifier of the target user""" - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None - """Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever""" + """Date when the user will be unbanned, unix time. If user is banned for more than 366 days or + less than 30 seconds from the current time they are considered to be banned forever""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/leave_chat.py b/aiogram/api/methods/leave_chat.py index 6c3e75ef..0827fc88 100644 --- a/aiogram/api/methods/leave_chat.py +++ b/aiogram/api/methods/leave_chat.py @@ -13,7 +13,8 @@ class LeaveChat(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target supergroup or channel (in + the format @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/pin_chat_message.py b/aiogram/api/methods/pin_chat_message.py index 1a312717..1d7383e7 100644 --- a/aiogram/api/methods/pin_chat_message.py +++ b/aiogram/api/methods/pin_chat_message.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod class PinChatMessage(TelegramMethod[bool]): """ - Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an + administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in + the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. Source: https://core.telegram.org/bots/api#pinchatmessage """ @@ -13,13 +15,13 @@ class PinChatMessage(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" message_id: int """Identifier of a message to pin""" - disable_notification: Optional[bool] = None - """Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels.""" + """Pass True, if it is not necessary to send a notification to all chat members about the new + pinned message. Notifications are always disabled in channels.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/promote_chat_member.py b/aiogram/api/methods/promote_chat_member.py index 8c602084..c05c9123 100644 --- a/aiogram/api/methods/promote_chat_member.py +++ b/aiogram/api/methods/promote_chat_member.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod 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 False for all boolean parameters to demote a user. Returns 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 admin rights. Pass + False for all boolean parameters to demote a user. Returns True on success. Source: https://core.telegram.org/bots/api#promotechatmember """ @@ -13,34 +15,29 @@ class PromoteChatMember(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" user_id: int """Unique identifier of the target user""" - can_change_info: Optional[bool] = None """Pass True, if the administrator can change chat title, photo and other settings""" - can_post_messages: Optional[bool] = None """Pass 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 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""" - can_invite_users: Optional[bool] = None """Pass True, if the administrator can invite new users to the chat""" - can_restrict_members: Optional[bool] = None """Pass True, if the administrator can restrict, ban or unban chat members""" - can_pin_messages: Optional[bool] = None """Pass True, if the administrator can pin messages, supergroups only""" - can_promote_members: Optional[bool] = None - """Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)""" + """Pass True, if the administrator can add new administrators with a subset of his own + privileges or demote administrators that he has promoted, directly or indirectly (promoted + by administrators that were appointed by him)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/restrict_chat_member.py b/aiogram/api/methods/restrict_chat_member.py index 6aa88fef..7ee5f8c1 100644 --- a/aiogram/api/methods/restrict_chat_member.py +++ b/aiogram/api/methods/restrict_chat_member.py @@ -7,7 +7,9 @@ from .base import Request, TelegramMethod 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 True for all permissions to lift restrictions from a user. Returns 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 admin rights. Pass True for all + permissions to lift restrictions from a user. Returns True on success. Source: https://core.telegram.org/bots/api#restrictchatmember """ @@ -15,16 +17,16 @@ class RestrictChatMember(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" - + """Unique identifier for the target chat or username of the target supergroup (in the format + @supergroupusername)""" user_id: int """Unique identifier of the target user""" - permissions: ChatPermissions """New user permissions""" - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None - """Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever""" + """Date when restrictions will be lifted for the user, unix time. If user is restricted for + more than 366 days or less than 30 seconds from the current time, they are considered to be + restricted forever""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_animation.py b/aiogram/api/methods/send_animation.py index 61483bc9..a373d818 100644 --- a/aiogram/api/methods/send_animation.py +++ b/aiogram/api/methods/send_animation.py @@ -13,7 +13,9 @@ from .base import Request, TelegramMethod class SendAnimation(TelegramMethod[Message]): """ - Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On + success, the sent Message is returned. Bots can currently send animation files of up to 50 MB + in size, this limit may be changed in the future. Source: https://core.telegram.org/bots/api#sendanimation """ @@ -21,39 +23,39 @@ class SendAnimation(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" animation: Union[InputFile, str] - """Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.""" - + """Animation to send. Pass a file_id as String to send an animation that exists on the + Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an + animation from the Internet, or upload a new animation using multipart/form-data.""" duration: Optional[int] = None """Duration of sent animation in seconds""" - width: Optional[int] = None """Animation width""" - height: Optional[int] = None """Animation height""" - thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" - + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Animation caption (may also be used when resending animation by file_id), 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_audio.py b/aiogram/api/methods/send_audio.py index 456143d4..ad671e0c 100644 --- a/aiogram/api/methods/send_audio.py +++ b/aiogram/api/methods/send_audio.py @@ -13,7 +13,10 @@ from .base import Request, TelegramMethod class SendAudio(TelegramMethod[Message]): """ - Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send audio files, if you want Telegram clients to display them in the music + player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is + returned. Bots can currently send audio files of up to 50 MB in size, this limit may be + changed in the future. For sending voice messages, use the sendVoice method instead. Source: https://core.telegram.org/bots/api#sendaudio @@ -22,39 +25,39 @@ class SendAudio(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" audio: Union[InputFile, str] - """Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data.""" - + """Audio file to send. Pass a file_id as String to send an audio file that exists on the + Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio + file from the Internet, or upload a new one using multipart/form-data.""" caption: Optional[str] = None """Audio caption, 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" duration: Optional[int] = None """Duration of the audio in seconds""" - performer: Optional[str] = None """Performer""" - title: Optional[str] = None """Track name""" - thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" - + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_chat_action.py b/aiogram/api/methods/send_chat_action.py index a17bace8..7f5710a3 100644 --- a/aiogram/api/methods/send_chat_action.py +++ b/aiogram/api/methods/send_chat_action.py @@ -5,9 +5,15 @@ from .base import Request, TelegramMethod class SendChatAction(TelegramMethod[bool]): """ - Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. - Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the bot. - We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. + Use this method when you need to tell the user that something is happening on the bot's side. + The status is set for 5 seconds or less (when a message arrives from your bot, Telegram + clients clear its typing status). Returns True on success. + Example: The ImageBot needs some time to process a request and upload the image. Instead of + sending a text message along the lines of 'Retrieving image, please wait…', the bot may use + sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the + bot. + We only recommend using this method when a response from the bot will take a noticeable amount + of time to arrive. Source: https://core.telegram.org/bots/api#sendchataction """ @@ -15,10 +21,13 @@ class SendChatAction(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" action: str - """Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.""" + """Type of action to broadcast. Choose one, depending on what the user is about to receive: + typing for text messages, upload_photo for photos, record_video or upload_video for videos, + record_audio or upload_audio for audio files, upload_document for general files, + find_location for location data, record_video_note or upload_video_note for video notes.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_contact.py b/aiogram/api/methods/send_contact.py index 61bdfdbb..b7569804 100644 --- a/aiogram/api/methods/send_contact.py +++ b/aiogram/api/methods/send_contact.py @@ -20,30 +20,25 @@ class SendContact(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" phone_number: str """Contact's phone number""" - first_name: str """Contact's first name""" - last_name: Optional[str] = None """Contact's last name""" - vcard: Optional[str] = None """Additional data about the contact in the form of a vCard, 0-2048 bytes""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_document.py b/aiogram/api/methods/send_document.py index be8988b5..9fd983fb 100644 --- a/aiogram/api/methods/send_document.py +++ b/aiogram/api/methods/send_document.py @@ -13,7 +13,9 @@ from .base import Request, TelegramMethod class SendDocument(TelegramMethod[Message]): """ - Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. + Use this method to send general files. On success, the sent Message is returned. Bots can + currently send files of any type of up to 50 MB in size, this limit may be changed in the + future. Source: https://core.telegram.org/bots/api#senddocument """ @@ -21,30 +23,33 @@ class SendDocument(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" document: Union[InputFile, str] - """File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" - + """File to send. Pass a file_id as String to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, + or upload a new one using multipart/form-data.""" thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" - + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Document caption (may also be used when resending documents by file_id), 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_game.py b/aiogram/api/methods/send_game.py index 6e265eb3..0e32c6eb 100644 --- a/aiogram/api/methods/send_game.py +++ b/aiogram/api/methods/send_game.py @@ -15,18 +15,16 @@ class SendGame(TelegramMethod[Message]): chat_id: int """Unique identifier for the target chat""" - game_short_name: str - """Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.""" - + """Short name of the game, serves as the unique identifier for the game. Set up your games via + Botfather.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[InlineKeyboardMarkup] = None - """A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game.""" + """A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button + will be shown. If not empty, the first button must launch the game.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_invoice.py b/aiogram/api/methods/send_invoice.py index 006b8b4e..aa2a5836 100644 --- a/aiogram/api/methods/send_invoice.py +++ b/aiogram/api/methods/send_invoice.py @@ -15,72 +15,56 @@ class SendInvoice(TelegramMethod[Message]): chat_id: int """Unique identifier for the target private chat""" - title: str """Product name, 1-32 characters""" - description: str """Product description, 1-255 characters""" - payload: str - """Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.""" - + """Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for + your internal processes.""" provider_token: str """Payments provider token, obtained via Botfather""" - start_parameter: str - """Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter""" - + """Unique deep-linking parameter that can be used to generate this invoice when used as a + start parameter""" currency: str """Three-letter ISO 4217 currency code, see more on currencies""" - prices: List[LabeledPrice] - """Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)""" - + """Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, + delivery tax, bonus, etc.)""" provider_data: Optional[str] = None - """JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.""" - + """JSON-encoded data about the invoice, which will be shared with the payment provider. A + detailed description of required fields should be provided by the payment provider.""" photo_url: Optional[str] = None - """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.""" - + """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image + for a service. People like it better when they see what they are paying for.""" photo_size: Optional[int] = None """Photo size""" - photo_width: Optional[int] = None """Photo width""" - photo_height: Optional[int] = None """Photo height""" - need_name: Optional[bool] = None """Pass True, if you require the user's full name to complete the order""" - need_phone_number: Optional[bool] = None """Pass True, if you require the user's phone number to complete the order""" - need_email: Optional[bool] = None """Pass True, if you require the user's email address to complete the order""" - need_shipping_address: Optional[bool] = None """Pass True, if you require the user's shipping address to complete the order""" - send_phone_number_to_provider: Optional[bool] = None """Pass True, if user's phone number should be sent to provider""" - send_email_to_provider: Optional[bool] = None """Pass True, if user's email address should be sent to provider""" - is_flexible: Optional[bool] = None """Pass True, if the final price depends on the shipping method""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[InlineKeyboardMarkup] = None - """A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.""" + """A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button + will be shown. If not empty, the first button must be a Pay button.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_location.py b/aiogram/api/methods/send_location.py index 455b60de..541a81fc 100644 --- a/aiogram/api/methods/send_location.py +++ b/aiogram/api/methods/send_location.py @@ -20,27 +20,24 @@ class SendLocation(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" latitude: float """Latitude of the location""" - longitude: float """Longitude of the location""" - live_period: Optional[int] = None - """Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.""" - + """Period in seconds for which the location will be updated (see Live Locations, should be + between 60 and 86400.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_media_group.py b/aiogram/api/methods/send_media_group.py index 340e0526..d07b8cbb 100644 --- a/aiogram/api/methods/send_media_group.py +++ b/aiogram/api/methods/send_media_group.py @@ -1,13 +1,13 @@ -import secrets from typing import Any, Dict, List, Optional, Union -from .base import Request, TelegramMethod from ..types import InputMediaPhoto, InputMediaVideo, Message, InputFile +from .base import Request, TelegramMethod class SendMediaGroup(TelegramMethod[List[Message]]): """ - Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. + Use this method to send a group of photos or videos as an album. On success, an array of the + sent Messages is returned. Source: https://core.telegram.org/bots/api#sendmediagroup """ @@ -15,14 +15,12 @@ class SendMediaGroup(TelegramMethod[List[Message]]): __returning__ = List[Message] chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" media: List[Union[InputMediaPhoto, InputMediaVideo]] """A JSON-serialized array describing photos and videos to be sent, must include 2–10 items""" - disable_notification: Optional[bool] = None """Sends the messages silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the messages are a reply, ID of the original message""" diff --git a/aiogram/api/methods/send_message.py b/aiogram/api/methods/send_message.py index 2ed80655..ba30debb 100644 --- a/aiogram/api/methods/send_message.py +++ b/aiogram/api/methods/send_message.py @@ -20,27 +20,24 @@ class SendMessage(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" text: str """Text of the message to be sent""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in your bot's message.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in this message""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_photo.py b/aiogram/api/methods/send_photo.py index 83563961..c1e3e854 100644 --- a/aiogram/api/methods/send_photo.py +++ b/aiogram/api/methods/send_photo.py @@ -21,27 +21,26 @@ class SendPhoto(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" photo: Union[InputFile, str] - """Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data.""" - + """Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers + (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, + or upload a new photo using multipart/form-data.""" caption: Optional[str] = None """Photo caption (may also be used when resending photos by file_id), 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_poll.py b/aiogram/api/methods/send_poll.py index 73dddeb4..b229368a 100644 --- a/aiogram/api/methods/send_poll.py +++ b/aiogram/api/methods/send_poll.py @@ -12,7 +12,8 @@ from .base import Request, TelegramMethod class SendPoll(TelegramMethod[Message]): """ - Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned. + Use this method to send a native poll. A native poll can't be sent to a private chat. On + success, the sent Message is returned. Source: https://core.telegram.org/bots/api#sendpoll """ @@ -20,24 +21,21 @@ class SendPoll(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername). A native poll can't be sent to a private chat.""" question: str """Poll question, 1-255 characters""" - options: List[str] """List of answer options, 2-10 strings 1-100 characters each""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_sticker.py b/aiogram/api/methods/send_sticker.py index c9da1ed9..bfab1b53 100644 --- a/aiogram/api/methods/send_sticker.py +++ b/aiogram/api/methods/send_sticker.py @@ -13,7 +13,8 @@ from .base import Request, TelegramMethod class SendSticker(TelegramMethod[Message]): """ - Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. + Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message + is returned. Source: https://core.telegram.org/bots/api#sendsticker """ @@ -21,21 +22,21 @@ class SendSticker(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" sticker: Union[InputFile, str] - """Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using multipart/form-data.""" - + """Sticker to send. Pass a file_id as String to send a file that exists on the Telegram + servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from + the Internet, or upload a new one using multipart/form-data.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_venue.py b/aiogram/api/methods/send_venue.py index 9707fee4..0e03dc6a 100644 --- a/aiogram/api/methods/send_venue.py +++ b/aiogram/api/methods/send_venue.py @@ -20,36 +20,30 @@ class SendVenue(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" latitude: float """Latitude of the venue""" - longitude: float """Longitude of the venue""" - title: str """Name of the venue""" - address: str """Address of the venue""" - foursquare_id: Optional[str] = None """Foursquare identifier of the venue""" - foursquare_type: Optional[str] = None - """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" - + """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', + 'arts_entertainment/aquarium' or 'food/icecream'.)""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/send_video.py b/aiogram/api/methods/send_video.py index 48c68713..e7cfdf28 100644 --- a/aiogram/api/methods/send_video.py +++ b/aiogram/api/methods/send_video.py @@ -13,7 +13,9 @@ from .base import Request, TelegramMethod class SendVideo(TelegramMethod[Message]): """ - Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. + Use this method to send video files, Telegram clients support mp4 videos (other formats may be + sent as Document). On success, the sent Message is returned. Bots can currently send video + files of up to 50 MB in size, this limit may be changed in the future. Source: https://core.telegram.org/bots/api#sendvideo """ @@ -21,42 +23,41 @@ class SendVideo(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" video: Union[InputFile, str] - """Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data.""" - + """Video to send. Pass a file_id as String to send a video that exists on the Telegram servers + (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, + or upload a new video using multipart/form-data.""" duration: Optional[int] = None """Duration of sent video in seconds""" - width: Optional[int] = None """Video width""" - height: Optional[int] = None """Video height""" - thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" - + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Video caption (may also be used when resending videos by file_id), 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" supports_streaming: Optional[bool] = None """Pass True, if the uploaded video is suitable for streaming""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_video_note.py b/aiogram/api/methods/send_video_note.py index c02cbc45..6cbdb779 100644 --- a/aiogram/api/methods/send_video_note.py +++ b/aiogram/api/methods/send_video_note.py @@ -13,7 +13,8 @@ from .base import Request, TelegramMethod class SendVideoNote(TelegramMethod[Message]): """ - As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. + As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use + this method to send video messages. On success, the sent Message is returned. Source: https://core.telegram.org/bots/api#sendvideonote """ @@ -21,30 +22,32 @@ class SendVideoNote(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" video_note: Union[InputFile, str] - """Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported""" - + """Video note to send. Pass a file_id as String to send a video note that exists on the + Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending + video notes by a URL is currently unsupported""" duration: Optional[int] = None """Duration of sent video in seconds""" - length: Optional[int] = None """Video width and height, i.e. diameter of the video message""" - thumb: Optional[Union[InputFile, str]] = None - """Thumbnail 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://' if the thumbnail was uploaded using multipart/form-data under .""" - + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/send_voice.py b/aiogram/api/methods/send_voice.py index 7e9092bf..aacbc196 100644 --- a/aiogram/api/methods/send_voice.py +++ b/aiogram/api/methods/send_voice.py @@ -13,7 +13,11 @@ from .base import Request, TelegramMethod class SendVoice(TelegramMethod[Message]): """ - Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. + Use this method to send audio files, if you want Telegram clients to display the file as a + playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS + (other formats may be sent as Audio or Document). On success, the sent Message is returned. + Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in + the future. Source: https://core.telegram.org/bots/api#sendvoice """ @@ -21,30 +25,28 @@ class SendVoice(TelegramMethod[Message]): __returning__ = Message chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" voice: Union[InputFile, str] - """Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" - + """Audio file to send. Pass a file_id as String to send a file that exists on the Telegram + servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the + Internet, or upload a new one using multipart/form-data.""" caption: Optional[str] = None """Voice message caption, 0-1024 characters""" - parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" - + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" duration: Optional[int] = None """Duration of the voice message in seconds""" - disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" - reply_to_message_id: Optional[int] = None """If the message is a reply, ID of the original message""" - reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None - """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" + """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply + keyboard, instructions to remove reply keyboard or to force a reply from the user.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/set_chat_description.py b/aiogram/api/methods/set_chat_description.py index 90a8f211..38c35138 100644 --- a/aiogram/api/methods/set_chat_description.py +++ b/aiogram/api/methods/set_chat_description.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod 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 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 admin rights. + Returns True on success. Source: https://core.telegram.org/bots/api#setchatdescription """ @@ -13,8 +15,8 @@ class SetChatDescription(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" description: Optional[str] = None """New chat description, 0-255 characters""" diff --git a/aiogram/api/methods/set_chat_permissions.py b/aiogram/api/methods/set_chat_permissions.py index 028f7377..5e415340 100644 --- a/aiogram/api/methods/set_chat_permissions.py +++ b/aiogram/api/methods/set_chat_permissions.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod 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 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 admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchatpermissions """ @@ -14,8 +16,8 @@ class SetChatPermissions(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" - + """Unique identifier for the target chat or username of the target supergroup (in the format + @supergroupusername)""" permissions: ChatPermissions """New default chat permissions""" diff --git a/aiogram/api/methods/set_chat_photo.py b/aiogram/api/methods/set_chat_photo.py index cc7dcef0..a1d9e1aa 100644 --- a/aiogram/api/methods/set_chat_photo.py +++ b/aiogram/api/methods/set_chat_photo.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod 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 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 admin rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchatphoto """ @@ -14,8 +16,8 @@ class SetChatPhoto(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" photo: InputFile """New chat photo, uploaded using multipart/form-data""" diff --git a/aiogram/api/methods/set_chat_sticker_set.py b/aiogram/api/methods/set_chat_sticker_set.py index c1347e7c..b7dc0ed0 100644 --- a/aiogram/api/methods/set_chat_sticker_set.py +++ b/aiogram/api/methods/set_chat_sticker_set.py @@ -5,7 +5,10 @@ from .base import Request, TelegramMethod 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 getChat requests to check if the bot can use this method. Returns 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 admin rights. Use the + field can_set_sticker_set optionally returned in getChat requests to check if the bot can use + this method. Returns True on success. Source: https://core.telegram.org/bots/api#setchatstickerset """ @@ -13,8 +16,8 @@ class SetChatStickerSet(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" - + """Unique identifier for the target chat or username of the target supergroup (in the format + @supergroupusername)""" sticker_set_name: str """Name of the sticker set to be set as the group sticker set""" diff --git a/aiogram/api/methods/set_chat_title.py b/aiogram/api/methods/set_chat_title.py index 1035b6ea..8337a1a1 100644 --- a/aiogram/api/methods/set_chat_title.py +++ b/aiogram/api/methods/set_chat_title.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod 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 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 admin + rights. Returns True on success. Source: https://core.telegram.org/bots/api#setchattitle """ @@ -13,8 +15,8 @@ class SetChatTitle(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" title: str """New chat title, 1-255 characters""" diff --git a/aiogram/api/methods/set_game_score.py b/aiogram/api/methods/set_game_score.py index b3f70efb..5e5dc397 100644 --- a/aiogram/api/methods/set_game_score.py +++ b/aiogram/api/methods/set_game_score.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod 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 Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. + 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 Message, otherwise returns True. Returns an error, if + the new score is not greater than the user's current score in the chat and force is False. Source: https://core.telegram.org/bots/api#setgamescore """ @@ -15,22 +17,18 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]): user_id: int """User identifier""" - 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 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 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 """Required if inline_message_id is not specified. Identifier of the sent message""" - inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" diff --git a/aiogram/api/methods/set_passport_data_errors.py b/aiogram/api/methods/set_passport_data_errors.py index 0280679e..44753546 100644 --- a/aiogram/api/methods/set_passport_data_errors.py +++ b/aiogram/api/methods/set_passport_data_errors.py @@ -6,8 +6,13 @@ from .base import Request, TelegramMethod class SetPassportDataErrors(TelegramMethod[bool]): """ - Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. - Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. + Informs a user that some of the Telegram Passport elements they provided contains errors. The + user will not be able to re-submit their Passport to you until the errors are fixed (the + contents of the field for which you returned the error must change). Returns True on success. + Use this if the data submitted by the user doesn't satisfy the standards your service requires + for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, + a scan shows evidence of tampering, etc. Supply some details in the error message to make sure + the user knows how to correct the issues. Source: https://core.telegram.org/bots/api#setpassportdataerrors """ @@ -16,7 +21,6 @@ class SetPassportDataErrors(TelegramMethod[bool]): user_id: int """User identifier""" - errors: List[PassportElementError] """A JSON-serialized array describing the errors""" diff --git a/aiogram/api/methods/set_sticker_position_in_set.py b/aiogram/api/methods/set_sticker_position_in_set.py index e75ca96a..c5b4a8a5 100644 --- a/aiogram/api/methods/set_sticker_position_in_set.py +++ b/aiogram/api/methods/set_sticker_position_in_set.py @@ -5,7 +5,8 @@ from .base import Request, TelegramMethod class SetStickerPositionInSet(TelegramMethod[bool]): """ - Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. + Use this method to move a sticker in a set created by the bot to a specific position . Returns + True on success. Source: https://core.telegram.org/bots/api#setstickerpositioninset """ @@ -14,7 +15,6 @@ class SetStickerPositionInSet(TelegramMethod[bool]): sticker: str """File identifier of the sticker""" - position: int """New sticker position in the set, zero-based""" diff --git a/aiogram/api/methods/set_webhook.py b/aiogram/api/methods/set_webhook.py index 575a21ce..c4e1d532 100644 --- a/aiogram/api/methods/set_webhook.py +++ b/aiogram/api/methods/set_webhook.py @@ -6,13 +6,21 @@ from .base import Request, TelegramMethod class SetWebhook(TelegramMethod[bool]): """ - Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. - If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/. Since nobody else knows your bot‘s token, you can be pretty sure it’s us. + Use this method to specify a url and receive incoming updates via an outgoing webhook. + Whenever there is an update for the bot, we will send an HTTPS POST request to the specified + url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up + after a reasonable amount of attempts. Returns True on success. + If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a + secret path in the URL, e.g. https://www.example.com/. Since nobody else knows your + bot‘s token, you can be pretty sure it’s us. Notes - 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. - 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. + 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook + is set up. + 2. To use a self-signed certificate, you need to upload your public key certificate using + certificate parameter. Please upload as InputFile, sending a String will not work. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443. - NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks. + NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to + Webhooks. Source: https://core.telegram.org/bots/api#setwebhook """ @@ -21,17 +29,18 @@ class SetWebhook(TelegramMethod[bool]): url: str """HTTPS url to send updates to. Use an empty string to remove webhook integration""" - certificate: Optional[InputFile] = None - """Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.""" - + """Upload your public key certificate so that the root certificate in use can be checked. See + our self-signed guide for details.""" max_connections: Optional[int] = None - """Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.""" - + """Maximum allowed number of simultaneous HTTPS connections to the webhook for update + delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, + and higher values to increase your bot’s throughput.""" allowed_updates: Optional[List[str]] = None - """List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. - - Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.""" + """List the types of updates you want your bot to receive. For example, specify ['message', + 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update + for a complete list of available update types. Specify an empty list to receive all updates + regardless of type (default). If not specified, the previous setting will be used.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/methods/stop_message_live_location.py b/aiogram/api/methods/stop_message_live_location.py index fdb0c544..f4f17910 100644 --- a/aiogram/api/methods/stop_message_live_location.py +++ b/aiogram/api/methods/stop_message_live_location.py @@ -6,7 +6,9 @@ from .base import Request, TelegramMethod 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 Message is returned, otherwise True is returned. + 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 Message is returned, otherwise True is + returned. Source: https://core.telegram.org/bots/api#stopmessagelivelocation """ @@ -14,14 +16,13 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] chat_id: Optional[Union[int, str]] = None - """Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Required if inline_message_id is not specified. Unique identifier for the target chat or + username of the target channel (in the format @channelusername)""" message_id: Optional[int] = None - """Required if inline_message_id is not specified. Identifier of the message with live location to stop""" - + """Required if inline_message_id is not specified. Identifier of the message with live + location to stop""" inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for a new inline keyboard.""" diff --git a/aiogram/api/methods/stop_poll.py b/aiogram/api/methods/stop_poll.py index f30ac5a1..d6be55b9 100644 --- a/aiogram/api/methods/stop_poll.py +++ b/aiogram/api/methods/stop_poll.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class StopPoll(TelegramMethod[Poll]): """ - Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. + Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with + the final results is returned. Source: https://core.telegram.org/bots/api#stoppoll """ @@ -14,11 +15,10 @@ class StopPoll(TelegramMethod[Poll]): __returning__ = Poll chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" - + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" message_id: int """Identifier of the original message with the poll""" - reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for a new message inline keyboard.""" diff --git a/aiogram/api/methods/unban_chat_member.py b/aiogram/api/methods/unban_chat_member.py index e609b7a3..09e6da6f 100644 --- a/aiogram/api/methods/unban_chat_member.py +++ b/aiogram/api/methods/unban_chat_member.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod class UnbanChatMember(TelegramMethod[bool]): """ - Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success. + Use this method to unban a previously kicked user in a supergroup or channel. The user will + not return to the group or channel automatically, but will be able to join via link, etc. The + bot must be an administrator for this to work. Returns True on success. Source: https://core.telegram.org/bots/api#unbanchatmember """ @@ -13,8 +15,8 @@ class UnbanChatMember(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target group or username of the target supergroup or channel (in the format @username)""" - + """Unique identifier for the target group or username of the target supergroup or channel (in + the format @username)""" user_id: int """Unique identifier of the target user""" diff --git a/aiogram/api/methods/unpin_chat_message.py b/aiogram/api/methods/unpin_chat_message.py index a1de809e..20cee142 100644 --- a/aiogram/api/methods/unpin_chat_message.py +++ b/aiogram/api/methods/unpin_chat_message.py @@ -5,7 +5,9 @@ from .base import Request, TelegramMethod class UnpinChatMessage(TelegramMethod[bool]): """ - Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. + Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an + administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in + the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. Source: https://core.telegram.org/bots/api#unpinchatmessage """ @@ -13,7 +15,8 @@ class UnpinChatMessage(TelegramMethod[bool]): __returning__ = bool chat_id: Union[int, str] - """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" + """Unique identifier for the target chat or username of the target channel (in the format + @channelusername)""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict() diff --git a/aiogram/api/methods/upload_sticker_file.py b/aiogram/api/methods/upload_sticker_file.py index ea031531..f5cdbafe 100644 --- a/aiogram/api/methods/upload_sticker_file.py +++ b/aiogram/api/methods/upload_sticker_file.py @@ -6,7 +6,8 @@ from .base import Request, TelegramMethod class UploadStickerFile(TelegramMethod[File]): """ - Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. + Use this method to upload a .png file with a sticker for later use in createNewStickerSet and + addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. Source: https://core.telegram.org/bots/api#uploadstickerfile """ @@ -15,9 +16,9 @@ class UploadStickerFile(TelegramMethod[File]): user_id: int """User identifier of sticker file owner""" - png_sticker: InputFile - """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.""" + """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed + 512px, and either width or height must be exactly 512px.""" def build_request(self) -> Request: data: Dict[str, Any] = self.dict( diff --git a/aiogram/api/types/callback_query.py b/aiogram/api/types/callback_query.py index c1fe62e3..042d26d8 100644 --- a/aiogram/api/types/callback_query.py +++ b/aiogram/api/types/callback_query.py @@ -13,8 +13,15 @@ if TYPE_CHECKING: class CallbackQuery(TelegramObject): """ - This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. - NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). + This object represents an incoming callback query from a callback button in an inline + keyboard. If the button that originated the query was attached to a message sent by the bot, + the field message will be present. If the button was attached to a message sent via the bot + (in inline mode), the field inline_message_id will be present. Exactly one of the fields data + or game_short_name will be present. + NOTE: After the user presses a callback button, Telegram clients will display a progress bar + until you call answerCallbackQuery. It is, therefore, necessary to react by calling + answerCallbackQuery even if no notification to the user is needed (e.g., without specifying + any of the optional parameters). Source: https://core.telegram.org/bots/api#callbackquery """ @@ -24,12 +31,15 @@ class CallbackQuery(TelegramObject): from_user: User = Field(..., alias="from") """Sender""" chat_instance: str - """Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.""" + """Global identifier, uniquely corresponding to the chat to which the message with the + callback button was sent. Useful for high scores in games.""" message: Optional[Message] = None - """Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old""" + """Message with the callback button that originated the query. Note that message content and + message date will not be available if the message is too old""" inline_message_id: Optional[str] = None """Identifier of the message sent via the bot in inline mode, that originated the query.""" data: Optional[str] = None - """Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.""" + """Data associated with the callback button. Be aware that a bad client can send arbitrary + data in this field.""" game_short_name: Optional[str] = None """Short name of a Game to be returned, serves as the unique identifier for the game""" diff --git a/aiogram/api/types/chat.py b/aiogram/api/types/chat.py index 987b8491..df5b9991 100644 --- a/aiogram/api/types/chat.py +++ b/aiogram/api/types/chat.py @@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject if TYPE_CHECKING: - from .message import Message from .chat_photo import ChatPhoto + from .message import Message from .chat_permissions import ChatPermissions @@ -18,7 +18,10 @@ class Chat(TelegramObject): """ id: int - """Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" + """Unique identifier for this chat. This number may be greater than 32 bits and some + programming languages may have difficulty/silent defects in interpreting it. But it is + smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe + for storing this identifier.""" type: str """Type of chat, can be either 'private', 'group', 'supergroup' or 'channel'""" title: Optional[str] = None @@ -34,7 +37,9 @@ class Chat(TelegramObject): description: Optional[str] = None """Description, for groups, supergroups and channel chats. Returned only in getChat.""" invite_link: Optional[str] = None - """Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.""" + """Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat + generates their own invite links, so the bot must first generate the link using + exportChatInviteLink. Returned only in getChat.""" pinned_message: Optional[Message] = None """Pinned message, for groups, supergroups and channels. Returned only in getChat.""" permissions: Optional[ChatPermissions] = None diff --git a/aiogram/api/types/chat_member.py b/aiogram/api/types/chat_member.py index 810e7e0a..b9311d1e 100644 --- a/aiogram/api/types/chat_member.py +++ b/aiogram/api/types/chat_member.py @@ -19,36 +19,47 @@ class ChatMember(TelegramObject): user: User """Information about the user""" status: str - """The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked'""" + """The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', + 'left' or 'kicked'""" until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None """Restricted and kicked only. Date when restrictions will be lifted for this user; unix time""" can_be_edited: Optional[bool] = None - """Administrators only. True, if the bot is allowed to edit administrator privileges of that user""" + """Administrators only. True, if the bot is allowed to edit administrator privileges of that + user""" can_post_messages: Optional[bool] = None """Administrators only. True, if the administrator can post in the channel; channels only""" can_edit_messages: Optional[bool] = None - """Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only""" + """Administrators only. True, if the administrator can edit messages of other users and can + pin messages; channels only""" can_delete_messages: Optional[bool] = None """Administrators only. True, if the administrator can delete messages of other users""" can_restrict_members: Optional[bool] = None """Administrators only. True, if the administrator can restrict, ban or unban chat members""" can_promote_members: Optional[bool] = None - """Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)""" + """Administrators only. True, if the administrator can add new administrators with a subset of + his own privileges or demote administrators that he has promoted, directly or indirectly + (promoted by administrators that were appointed by the user)""" can_change_info: Optional[bool] = None - """Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings""" + """Administrators and restricted only. True, if the user is allowed to change the chat title, + photo and other settings""" can_invite_users: Optional[bool] = None - """Administrators and restricted only. True, if the user is allowed to invite new users to the chat""" + """Administrators and restricted only. True, if the user is allowed to invite new users to the + chat""" can_pin_messages: Optional[bool] = None - """Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only""" + """Administrators and restricted only. True, if the user is allowed to pin messages; groups + and supergroups only""" is_member: Optional[bool] = None """Restricted only. True, if the user is a member of the chat at the moment of the request""" can_send_messages: Optional[bool] = None - """Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues""" + """Restricted only. True, if the user is allowed to send text messages, contacts, locations + and venues""" can_send_media_messages: Optional[bool] = None - """Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes""" + """Restricted only. True, if the user is allowed to send audios, documents, photos, videos, + video notes and voice notes""" can_send_polls: Optional[bool] = None """Restricted only. True, if the user is allowed to send polls""" can_send_other_messages: Optional[bool] = None - """Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots""" + """Restricted only. True, if the user is allowed to send animations, games, stickers and use + inline bots""" can_add_web_page_previews: Optional[bool] = None """Restricted only. True, if the user is allowed to add web page previews to their messages""" diff --git a/aiogram/api/types/chat_permissions.py b/aiogram/api/types/chat_permissions.py index aa57baae..b75da52b 100644 --- a/aiogram/api/types/chat_permissions.py +++ b/aiogram/api/types/chat_permissions.py @@ -15,15 +15,19 @@ class ChatPermissions(TelegramObject): can_send_messages: Optional[bool] = None """True, if the user is allowed to send text messages, contacts, locations and venues""" can_send_media_messages: Optional[bool] = None - """True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages""" + """True, if the user is allowed to send audios, documents, photos, videos, video notes and + voice notes, implies can_send_messages""" can_send_polls: Optional[bool] = None """True, if the user is allowed to send polls, implies can_send_messages""" can_send_other_messages: Optional[bool] = None - """True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages""" + """True, if the user is allowed to send animations, games, stickers and use inline bots, + implies can_send_media_messages""" can_add_web_page_previews: Optional[bool] = None - """True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages""" + """True, if the user is allowed to add web page previews to their messages, implies + can_send_media_messages""" can_change_info: Optional[bool] = None - """True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups""" + """True, if the user is allowed to change the chat title, photo and other settings. Ignored in + public supergroups""" can_invite_users: Optional[bool] = None """True, if the user is allowed to invite new users to the chat""" can_pin_messages: Optional[bool] = None diff --git a/aiogram/api/types/chat_photo.py b/aiogram/api/types/chat_photo.py index e1c9f21e..87429764 100644 --- a/aiogram/api/types/chat_photo.py +++ b/aiogram/api/types/chat_photo.py @@ -11,6 +11,8 @@ class ChatPhoto(TelegramObject): """ small_file_id: str - """File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" + """File identifier of small (160x160) chat photo. This file_id can be used only for photo + download and only for as long as the photo is not changed.""" big_file_id: str - """File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" + """File identifier of big (640x640) chat photo. This file_id can be used only for photo + download and only for as long as the photo is not changed.""" diff --git a/aiogram/api/types/chosen_inline_result.py b/aiogram/api/types/chosen_inline_result.py index 8ccee7e5..270fbecb 100644 --- a/aiogram/api/types/chosen_inline_result.py +++ b/aiogram/api/types/chosen_inline_result.py @@ -13,8 +13,10 @@ if TYPE_CHECKING: class ChosenInlineResult(TelegramObject): """ - Represents a result of an inline query that was chosen by the user and sent to their chat partner. - Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates. + Represents a result of an inline query that was chosen by the user and sent to their chat + partner. + Note: It is necessary to enable inline feedback via @Botfather in order to receive these + objects in updates. Source: https://core.telegram.org/bots/api#choseninlineresult """ @@ -28,4 +30,6 @@ class ChosenInlineResult(TelegramObject): location: Optional[Location] = None """Sender location, only for bots that require user location""" inline_message_id: Optional[str] = None - """Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.""" + """Identifier of the sent inline message. Available only if there is an inline keyboard + attached to the message. Will be also received in callback queries and can be used to edit + the message.""" diff --git a/aiogram/api/types/encrypted_credentials.py b/aiogram/api/types/encrypted_credentials.py index a28d5cd3..7cf2c1e1 100644 --- a/aiogram/api/types/encrypted_credentials.py +++ b/aiogram/api/types/encrypted_credentials.py @@ -5,14 +5,18 @@ from .base import TelegramObject class EncryptedCredentials(TelegramObject): """ - Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. + Contains data required for decrypting and authenticating EncryptedPassportElement. See the + Telegram Passport Documentation for a complete description of the data decryption and + authentication processes. Source: https://core.telegram.org/bots/api#encryptedcredentials """ data: str - """Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication""" + """Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and + secrets required for EncryptedPassportElement decryption and authentication""" hash: str """Base64-encoded data hash for data authentication""" secret: str - """Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption""" + """Base64-encoded secret, encrypted with the bot's public RSA key, required for data + decryption""" diff --git a/aiogram/api/types/encrypted_passport_element.py b/aiogram/api/types/encrypted_passport_element.py index 73c5d220..7ce66e0a 100644 --- a/aiogram/api/types/encrypted_passport_element.py +++ b/aiogram/api/types/encrypted_passport_element.py @@ -10,28 +10,45 @@ if TYPE_CHECKING: class EncryptedPassportElement(TelegramObject): """ - Contains information about documents or other Telegram Passport elements shared with the bot by the user. + Contains information about documents or other Telegram Passport elements shared with the bot + by the user. Source: https://core.telegram.org/bots/api#encryptedpassportelement """ type: str - """Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration', 'phone_number', 'email'.""" + """Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', + 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', + 'passport_registration', 'temporary_registration', 'phone_number', 'email'.""" hash: str """Base64-encoded element hash for using in PassportElementErrorUnspecified""" data: Optional[str] = None - """Base64-encoded encrypted Telegram Passport element data provided by the user, available for 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and 'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Base64-encoded encrypted Telegram Passport element data provided by the user, available for + 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and + 'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials.""" phone_number: Optional[str] = None """User's verified phone number, available only for 'phone_number' type""" email: Optional[str] = None """User's verified email address, available only for 'email' type""" files: Optional[List[PassportFile]] = None - """Array of encrypted files with documents provided by the user, available for 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Array of encrypted files with documents provided by the user, available for 'utility_bill', + 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' + types. Files can be decrypted and verified using the accompanying EncryptedCredentials.""" front_side: Optional[PassportFile] = None - """Encrypted file with the front side of the document, provided by the user. Available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Encrypted file with the front side of the document, provided by the user. Available for + 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be + decrypted and verified using the accompanying EncryptedCredentials.""" reverse_side: Optional[PassportFile] = None - """Encrypted file with the reverse side of the document, provided by the user. Available for 'driver_license' and 'identity_card'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Encrypted file with the reverse side of the document, provided by the user. Available for + 'driver_license' and 'identity_card'. The file can be decrypted and verified using the + accompanying EncryptedCredentials.""" selfie: Optional[PassportFile] = None - """Encrypted file with the selfie of the user holding a document, provided by the user; available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Encrypted file with the selfie of the user holding a document, provided by the user; + available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The + file can be decrypted and verified using the accompanying EncryptedCredentials.""" translation: Optional[List[PassportFile]] = None - """Array of encrypted files with translated versions of documents provided by the user. Available if requested for 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials.""" + """Array of encrypted files with translated versions of documents provided by the user. + Available if requested for 'passport', 'driver_license', 'identity_card', + 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', + 'passport_registration' and 'temporary_registration' types. Files can be decrypted and + verified using the accompanying EncryptedCredentials.""" diff --git a/aiogram/api/types/file.py b/aiogram/api/types/file.py index 1880f52a..25551a8c 100644 --- a/aiogram/api/types/file.py +++ b/aiogram/api/types/file.py @@ -7,7 +7,10 @@ from .base import TelegramObject class File(TelegramObject): """ - This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot/. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. + This object represents a file ready to be downloaded. The file can be downloaded via the link + https://api.telegram.org/file/bot/. It is guaranteed that the link will be + valid for at least 1 hour. When the link expires, a new one can be requested by calling + getFile. Maximum file size to download is 20 MB Source: https://core.telegram.org/bots/api#file diff --git a/aiogram/api/types/force_reply.py b/aiogram/api/types/force_reply.py index 6a9c2c44..5652b0ae 100644 --- a/aiogram/api/types/force_reply.py +++ b/aiogram/api/types/force_reply.py @@ -7,17 +7,29 @@ from .base import TelegramObject class ForceReply(TelegramObject): """ - Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. - Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: + Upon receiving a message with this object, Telegram clients will display a reply interface to + the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be + extremely useful if you want to create user-friendly step-by-step interfaces without having to + sacrifice privacy mode. + Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its + messages and mentions). There could be two ways to create a new poll: - Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish. - Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now let’s add the first answer option‘, ’Great. Keep adding answer options, then send /done when you‘re ready’. - The last option is definitely more attractive. And if you use ForceReply in your bot‘s questions, it will receive the user’s answers even if it only receives replies, commands and mentions — without any extra work for the user. + Explain the user how to send a command with parameters (e.g. /newpoll question answer1 + answer2). May be appealing for hardcore users but lacks modern day polish. + Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now + let’s add the first answer option‘, ’Great. Keep adding answer options, then send /done when + you‘re ready’. + The last option is definitely more attractive. And if you use ForceReply in your bot‘s + questions, it will receive the user’s answers even if it only receives replies, commands and + mentions — without any extra work for the user. Source: https://core.telegram.org/bots/api#forcereply """ force_reply: bool - """Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'""" + """Shows reply interface to the user, as if they manually selected the bot‘s message and + tapped ’Reply'""" selective: Optional[bool] = None - """Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.""" + """Use this parameter if you want to force reply from specific users only. Targets: 1) users + that are @mentioned in the text of the Message object; 2) if the bot's message is a reply + (has reply_to_message_id), sender of the original message.""" diff --git a/aiogram/api/types/game.py b/aiogram/api/types/game.py index ce8f85e2..899e8030 100644 --- a/aiogram/api/types/game.py +++ b/aiogram/api/types/game.py @@ -12,7 +12,8 @@ if TYPE_CHECKING: class Game(TelegramObject): """ - This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. + This object represents a game. Use BotFather to create and edit games, their short names will + act as unique identifiers. Source: https://core.telegram.org/bots/api#game """ @@ -24,7 +25,9 @@ class Game(TelegramObject): photo: List[PhotoSize] """Photo that will be displayed in the game message in chats.""" text: Optional[str] = None - """Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.""" + """Brief description of the game or high scores included in the game message. Can be + automatically edited to include current high scores for the game when the bot calls + setGameScore, or manually edited using editMessageText. 0-4096 characters.""" text_entities: Optional[List[MessageEntity]] = None """Special entities that appear in text, such as usernames, URLs, bot commands, etc.""" animation: Optional[Animation] = None diff --git a/aiogram/api/types/inline_keyboard_button.py b/aiogram/api/types/inline_keyboard_button.py index 4d51b9e9..46372a17 100644 --- a/aiogram/api/types/inline_keyboard_button.py +++ b/aiogram/api/types/inline_keyboard_button.py @@ -5,13 +5,14 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject if TYPE_CHECKING: - from .login_url import LoginUrl from .callback_game import CallbackGame + from .login_url import LoginUrl class InlineKeyboardButton(TelegramObject): """ - This object represents one button of an inline keyboard. You must use exactly one of the optional fields. + This object represents one button of an inline keyboard. You must use exactly one of the + optional fields. Source: https://core.telegram.org/bots/api#inlinekeyboardbutton """ @@ -21,22 +22,19 @@ class InlineKeyboardButton(TelegramObject): url: Optional[str] = None """HTTP or tg:// url to be opened when button is pressed""" login_url: Optional[LoginUrl] = None - """An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.""" + """An HTTP URL used to automatically authorize the user. Can be used as a replacement for the + Telegram Login Widget.""" callback_data: Optional[str] = None """Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes""" switch_inline_query: Optional[str] = None - """If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted. - - Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.""" + """If set, pressing the button will prompt the user to select one of their chats, open that + chat and insert the bot‘s username and the specified inline query in the input field. Can + be empty, in which case just the bot’s username will be inserted.""" switch_inline_query_current_chat: Optional[str] = None - """If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted. - - This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options.""" + """If set, pressing the button will insert the bot‘s username and the specified inline query + in the current chat's input field. Can be empty, in which case only the bot’s username will + be inserted.""" callback_game: Optional[CallbackGame] = None - """Description of the game that will be launched when the user presses the button. - - NOTE: This type of button must always be the first button in the first row.""" + """Description of the game that will be launched when the user presses the button.""" pay: Optional[bool] = None - """Specify True, to send a Pay button. - - NOTE: This type of button must always be the first button in the first row.""" + """Specify True, to send a Pay button.""" diff --git a/aiogram/api/types/inline_keyboard_markup.py b/aiogram/api/types/inline_keyboard_markup.py index 3237d633..6c83cb9a 100644 --- a/aiogram/api/types/inline_keyboard_markup.py +++ b/aiogram/api/types/inline_keyboard_markup.py @@ -10,8 +10,10 @@ if TYPE_CHECKING: class InlineKeyboardMarkup(TelegramObject): """ - This object represents an inline keyboard that appears right next to the message it belongs to. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. + This object represents an inline keyboard that appears right next to the message it belongs + to. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will display unsupported message. Source: https://core.telegram.org/bots/api#inlinekeyboardmarkup """ diff --git a/aiogram/api/types/inline_query.py b/aiogram/api/types/inline_query.py index f9399653..203f8372 100644 --- a/aiogram/api/types/inline_query.py +++ b/aiogram/api/types/inline_query.py @@ -13,7 +13,8 @@ if TYPE_CHECKING: class InlineQuery(TelegramObject): """ - This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. + This object represents an incoming inline query. When the user sends an empty query, your bot + could return some default or trending results. Source: https://core.telegram.org/bots/api#inlinequery """ diff --git a/aiogram/api/types/inline_query_result.py b/aiogram/api/types/inline_query_result.py index eb780354..95f97dac 100644 --- a/aiogram/api/types/inline_query_result.py +++ b/aiogram/api/types/inline_query_result.py @@ -5,7 +5,8 @@ from .base import TelegramObject class InlineQueryResult(TelegramObject): """ - This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: + This object represents one result of an inline query. Telegram clients currently support + results of the following 20 types: - InlineQueryResultCachedAudio - InlineQueryResultCachedDocument - InlineQueryResultCachedGif diff --git a/aiogram/api/types/inline_query_result_article.py b/aiogram/api/types/inline_query_result_article.py index 4860e396..4af454c5 100644 --- a/aiogram/api/types/inline_query_result_article.py +++ b/aiogram/api/types/inline_query_result_article.py @@ -7,8 +7,8 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultArticle(InlineQueryResult): diff --git a/aiogram/api/types/inline_query_result_audio.py b/aiogram/api/types/inline_query_result_audio.py index 4f48e4e1..d9fbe701 100644 --- a/aiogram/api/types/inline_query_result_audio.py +++ b/aiogram/api/types/inline_query_result_audio.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultAudio(InlineQueryResult): """ - Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. + Alternatively, you can use input_message_content to send a message with the specified content + instead of the audio. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultaudio """ @@ -30,7 +33,8 @@ class InlineQueryResultAudio(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" performer: Optional[str] = None """Performer""" audio_duration: Optional[int] = None diff --git a/aiogram/api/types/inline_query_result_cached_audio.py b/aiogram/api/types/inline_query_result_cached_audio.py index 4eaee573..3a8c65ad 100644 --- a/aiogram/api/types/inline_query_result_cached_audio.py +++ b/aiogram/api/types/inline_query_result_cached_audio.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedAudio(InlineQueryResult): """ - Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio + file will be sent by the user. Alternatively, you can use input_message_content to send a + message with the specified content instead of the audio. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedaudio """ @@ -28,7 +31,8 @@ class InlineQueryResultCachedAudio(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_document.py b/aiogram/api/types/inline_query_result_cached_document.py index ed71b478..f7c525b9 100644 --- a/aiogram/api/types/inline_query_result_cached_document.py +++ b/aiogram/api/types/inline_query_result_cached_document.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedDocument(InlineQueryResult): """ - Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to a file stored on the Telegram servers. By default, this file will be sent + by the user with an optional caption. Alternatively, you can use input_message_content to send + a message with the specified content instead of the file. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultcacheddocument """ @@ -32,7 +35,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult): caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_gif.py b/aiogram/api/types/inline_query_result_cached_gif.py index 01417ee6..08d0913d 100644 --- a/aiogram/api/types/inline_query_result_cached_gif.py +++ b/aiogram/api/types/inline_query_result_cached_gif.py @@ -7,13 +7,15 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedGif(InlineQueryResult): """ - Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. + Represents a link to an animated GIF file stored on the Telegram servers. By default, this + animated GIF file will be sent by the user with an optional caption. Alternatively, you can + use input_message_content to send a message with specified content instead of the animation. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedgif """ @@ -29,7 +31,8 @@ class InlineQueryResultCachedGif(InlineQueryResult): caption: Optional[str] = None """Caption of the GIF file to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py index a6e06d80..63065043 100644 --- a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py @@ -7,13 +7,16 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): """ - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the + Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an + optional caption. Alternatively, you can use input_message_content to send a message with the + specified content instead of the animation. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif """ @@ -29,7 +32,8 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): caption: Optional[str] = None """Caption of the MPEG-4 file to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_photo.py b/aiogram/api/types/inline_query_result_cached_photo.py index 8605f262..b28adf33 100644 --- a/aiogram/api/types/inline_query_result_cached_photo.py +++ b/aiogram/api/types/inline_query_result_cached_photo.py @@ -7,13 +7,15 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedPhoto(InlineQueryResult): """ - Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. + Represents a link to a photo stored on the Telegram servers. By default, this photo will be + sent by the user with an optional caption. Alternatively, you can use input_message_content to + send a message with the specified content instead of the photo. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedphoto """ @@ -31,7 +33,8 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_sticker.py b/aiogram/api/types/inline_query_result_cached_sticker.py index 8909eaee..a24a52b9 100644 --- a/aiogram/api/types/inline_query_result_cached_sticker.py +++ b/aiogram/api/types/inline_query_result_cached_sticker.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedSticker(InlineQueryResult): """ - Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. - Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them. + Represents a link to a sticker stored on the Telegram servers. By default, this sticker will + be sent by the user. Alternatively, you can use input_message_content to send a message with + the specified content instead of the sticker. + Note: This will only work in Telegram versions released after 9 April, 2016 for static + stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedsticker """ diff --git a/aiogram/api/types/inline_query_result_cached_video.py b/aiogram/api/types/inline_query_result_cached_video.py index 52d9154e..e35f43c4 100644 --- a/aiogram/api/types/inline_query_result_cached_video.py +++ b/aiogram/api/types/inline_query_result_cached_video.py @@ -7,13 +7,15 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedVideo(InlineQueryResult): """ - Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. + Represents a link to a video file stored on the Telegram servers. By default, this video file + will be sent by the user with an optional caption. Alternatively, you can use + input_message_content to send a message with the specified content instead of the video. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvideo """ @@ -31,7 +33,8 @@ class InlineQueryResultCachedVideo(InlineQueryResult): caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_voice.py b/aiogram/api/types/inline_query_result_cached_voice.py index 83446125..30ea495b 100644 --- a/aiogram/api/types/inline_query_result_cached_voice.py +++ b/aiogram/api/types/inline_query_result_cached_voice.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultCachedVoice(InlineQueryResult): """ - Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to a voice message stored on the Telegram servers. By default, this voice + message will be sent by the user. Alternatively, you can use input_message_content to send a + message with the specified content instead of the voice message. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvoice """ @@ -30,7 +33,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_contact.py b/aiogram/api/types/inline_query_result_contact.py index bc2c257e..6637dc50 100644 --- a/aiogram/api/types/inline_query_result_contact.py +++ b/aiogram/api/types/inline_query_result_contact.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultContact(InlineQueryResult): """ - Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a contact with a phone number. By default, this contact will be sent by the user. + Alternatively, you can use input_message_content to send a message with the specified content + instead of the contact. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultcontact """ diff --git a/aiogram/api/types/inline_query_result_document.py b/aiogram/api/types/inline_query_result_document.py index 762336da..c1dfef53 100644 --- a/aiogram/api/types/inline_query_result_document.py +++ b/aiogram/api/types/inline_query_result_document.py @@ -7,14 +7,18 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultDocument(InlineQueryResult): """ - Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to a file. By default, this file will be sent by the user with an optional + caption. Alternatively, you can use input_message_content to send a message with the specified + content instead of the file. Currently, only .PDF and .ZIP files can be sent using this + method. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultdocument """ @@ -32,7 +36,8 @@ class InlineQueryResultDocument(InlineQueryResult): caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" description: Optional[str] = None """Short description of the result""" reply_markup: Optional[InlineKeyboardMarkup] = None diff --git a/aiogram/api/types/inline_query_result_game.py b/aiogram/api/types/inline_query_result_game.py index 46217690..708c7ebf 100644 --- a/aiogram/api/types/inline_query_result_game.py +++ b/aiogram/api/types/inline_query_result_game.py @@ -13,7 +13,8 @@ if TYPE_CHECKING: class InlineQueryResultGame(InlineQueryResult): """ Represents a Game. - Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. + Note: This will only work in Telegram versions released after October 1, 2016. Older clients + will not display any inline results if a game result is among them. Source: https://core.telegram.org/bots/api#inlinequeryresultgame """ diff --git a/aiogram/api/types/inline_query_result_gif.py b/aiogram/api/types/inline_query_result_gif.py index 0e82679e..65ac888a 100644 --- a/aiogram/api/types/inline_query_result_gif.py +++ b/aiogram/api/types/inline_query_result_gif.py @@ -7,13 +7,15 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultGif(InlineQueryResult): """ - Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + Represents a link to an animated GIF file. By default, this animated GIF file will be sent by + the user with optional caption. Alternatively, you can use input_message_content to send a + message with the specified content instead of the animation. Source: https://core.telegram.org/bots/api#inlinequeryresultgif """ @@ -37,7 +39,8 @@ class InlineQueryResultGif(InlineQueryResult): caption: Optional[str] = None """Caption of the GIF file to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_location.py b/aiogram/api/types/inline_query_result_location.py index 18f0f756..13bdb194 100644 --- a/aiogram/api/types/inline_query_result_location.py +++ b/aiogram/api/types/inline_query_result_location.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultLocation(InlineQueryResult): """ - Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a location on a map. By default, the location will be sent by the user. + Alternatively, you can use input_message_content to send a message with the specified content + instead of the location. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultlocation """ diff --git a/aiogram/api/types/inline_query_result_mpeg4_gif.py b/aiogram/api/types/inline_query_result_mpeg4_gif.py index 173acc70..e2e80fb8 100644 --- a/aiogram/api/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_mpeg4_gif.py @@ -7,13 +7,16 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultMpeg4Gif(InlineQueryResult): """ - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, + this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you + can use input_message_content to send a message with the specified content instead of the + animation. Source: https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif """ @@ -37,7 +40,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): caption: Optional[str] = None """Caption of the MPEG-4 file to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_photo.py b/aiogram/api/types/inline_query_result_photo.py index f2356c1e..9161ce82 100644 --- a/aiogram/api/types/inline_query_result_photo.py +++ b/aiogram/api/types/inline_query_result_photo.py @@ -7,13 +7,15 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultPhoto(InlineQueryResult): """ - Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. + Represents a link to a photo. By default, this photo will be sent by the user with optional + caption. Alternatively, you can use input_message_content to send a message with the specified + content instead of the photo. Source: https://core.telegram.org/bots/api#inlinequeryresultphoto """ @@ -37,7 +39,8 @@ class InlineQueryResultPhoto(InlineQueryResult): caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_venue.py b/aiogram/api/types/inline_query_result_venue.py index 7d3029b1..abde29ef 100644 --- a/aiogram/api/types/inline_query_result_venue.py +++ b/aiogram/api/types/inline_query_result_venue.py @@ -7,14 +7,16 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultVenue(InlineQueryResult): """ - Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use + input_message_content to send a message with the specified content instead of the venue. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultvenue """ @@ -34,7 +36,8 @@ class InlineQueryResultVenue(InlineQueryResult): foursquare_id: Optional[str] = None """Foursquare identifier of the venue if known""" foursquare_type: Optional[str] = None - """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" + """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', + 'arts_entertainment/aquarium' or 'food/icecream'.)""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_video.py b/aiogram/api/types/inline_query_result_video.py index 41f7d442..592ff060 100644 --- a/aiogram/api/types/inline_query_result_video.py +++ b/aiogram/api/types/inline_query_result_video.py @@ -7,14 +7,17 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultVideo(InlineQueryResult): """ - Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. - If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. + Represents a link to a page containing an embedded video player or a video file. By default, + this video file will be sent by the user with an optional caption. Alternatively, you can use + input_message_content to send a message with the specified content instead of the video. + If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must + replace its content using input_message_content. Source: https://core.telegram.org/bots/api#inlinequeryresultvideo """ @@ -34,7 +37,8 @@ class InlineQueryResultVideo(InlineQueryResult): caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" video_width: Optional[int] = None """Video width""" video_height: Optional[int] = None @@ -46,4 +50,5 @@ class InlineQueryResultVideo(InlineQueryResult): reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None - """Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).""" + """Content of the message to be sent instead of the video. This field is required if + InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).""" diff --git a/aiogram/api/types/inline_query_result_voice.py b/aiogram/api/types/inline_query_result_voice.py index d71df302..7a4d5bdc 100644 --- a/aiogram/api/types/inline_query_result_voice.py +++ b/aiogram/api/types/inline_query_result_voice.py @@ -7,14 +7,18 @@ from pydantic import Field from .inline_query_result import InlineQueryResult if TYPE_CHECKING: - from .inline_keyboard_markup import InlineKeyboardMarkup from .input_message_content import InputMessageContent + from .inline_keyboard_markup import InlineKeyboardMarkup class InlineQueryResultVoice(InlineQueryResult): """ - Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. - Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, + this voice recording will be sent by the user. Alternatively, you can use + input_message_content to send a message with the specified content instead of the the voice + message. + Note: This will only work in Telegram versions released after 9 April, 2016. Older clients + will ignore them. Source: https://core.telegram.org/bots/api#inlinequeryresultvoice """ @@ -30,7 +34,8 @@ class InlineQueryResultVoice(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" voice_duration: Optional[int] = None """Recording duration in seconds""" reply_markup: Optional[InlineKeyboardMarkup] = None diff --git a/aiogram/api/types/input_file.py b/aiogram/api/types/input_file.py index 806ec3d3..6261133c 100644 --- a/aiogram/api/types/input_file.py +++ b/aiogram/api/types/input_file.py @@ -13,7 +13,8 @@ DEFAULT_CHUNK_SIZE = 64 * 1024 # 64 kb class InputFile(ABC): """ - This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. + This object represents the contents of a file to be uploaded. Must be posted using + multipart/form-data in the usual way that files are uploaded via the browser. Source: https://core.telegram.org/bots/api#inputfile """ diff --git a/aiogram/api/types/input_media_animation.py b/aiogram/api/types/input_media_animation.py index fe911c69..d8226998 100644 --- a/aiogram/api/types/input_media_animation.py +++ b/aiogram/api/types/input_media_animation.py @@ -20,13 +20,22 @@ class InputMediaAnimation(InputMedia): type: str = Field("animation", const=True) """Type of the result, must be animation""" media: Union[str, InputFile] - """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name.""" + """File to send. Pass a file_id to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass + 'attach://' to upload a new one using multipart/form-data under + name.""" thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Caption of the animation to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" width: Optional[int] = None """Animation width""" height: Optional[int] = None diff --git a/aiogram/api/types/input_media_audio.py b/aiogram/api/types/input_media_audio.py index e16a034b..23f8e190 100644 --- a/aiogram/api/types/input_media_audio.py +++ b/aiogram/api/types/input_media_audio.py @@ -20,13 +20,22 @@ class InputMediaAudio(InputMedia): type: str = Field("audio", const=True) """Type of the result, must be audio""" media: Union[str, InputFile] - """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name.""" + """File to send. Pass a file_id to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass + 'attach://' to upload a new one using multipart/form-data under + name.""" thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Caption of the audio to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" duration: Optional[int] = None """Duration of the audio in seconds""" performer: Optional[str] = None diff --git a/aiogram/api/types/input_media_document.py b/aiogram/api/types/input_media_document.py index e23b82dc..56a275aa 100644 --- a/aiogram/api/types/input_media_document.py +++ b/aiogram/api/types/input_media_document.py @@ -20,10 +20,19 @@ class InputMediaDocument(InputMedia): type: str = Field("document", const=True) """Type of the result, must be document""" media: Union[str, InputFile] - """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name.""" + """File to send. Pass a file_id to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass + 'attach://' to upload a new one using multipart/form-data under + name.""" thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" diff --git a/aiogram/api/types/input_media_photo.py b/aiogram/api/types/input_media_photo.py index 19d91f3e..1ecc3a4d 100644 --- a/aiogram/api/types/input_media_photo.py +++ b/aiogram/api/types/input_media_photo.py @@ -20,8 +20,12 @@ class InputMediaPhoto(InputMedia): type: str = Field("photo", const=True) """Type of the result, must be photo""" media: Union[str, InputFile] - """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name.""" + """File to send. Pass a file_id to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass + 'attach://' to upload a new one using multipart/form-data under + name.""" caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" diff --git a/aiogram/api/types/input_media_video.py b/aiogram/api/types/input_media_video.py index 96146655..121132db 100644 --- a/aiogram/api/types/input_media_video.py +++ b/aiogram/api/types/input_media_video.py @@ -20,13 +20,22 @@ class InputMediaVideo(InputMedia): type: str = Field("video", const=True) """Type of the result, must be video""" media: Union[str, InputFile] - """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name.""" + """File to send. Pass a file_id to send a file that exists on the Telegram servers + (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass + 'attach://' to upload a new one using multipart/form-data under + name.""" thumb: Optional[Union[InputFile, str]] = None - """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under .""" + """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://' if the thumbnail was uploaded using + multipart/form-data under .""" caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in the media caption.""" width: Optional[int] = None """Video width""" height: Optional[int] = None diff --git a/aiogram/api/types/input_message_content.py b/aiogram/api/types/input_message_content.py index e6260cb1..38da01f8 100644 --- a/aiogram/api/types/input_message_content.py +++ b/aiogram/api/types/input_message_content.py @@ -5,7 +5,8 @@ from .base import TelegramObject class InputMessageContent(TelegramObject): """ - This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 4 types: + This object represents the content of a message to be sent as a result of an inline query. + Telegram clients currently support the following 4 types: - InputTextMessageContent - InputLocationMessageContent - InputVenueMessageContent diff --git a/aiogram/api/types/input_text_message_content.py b/aiogram/api/types/input_text_message_content.py index e042adb9..ff3ef5d9 100644 --- a/aiogram/api/types/input_text_message_content.py +++ b/aiogram/api/types/input_text_message_content.py @@ -15,6 +15,7 @@ class InputTextMessageContent(InputMessageContent): message_text: str """Text of the message to be sent, 1-4096 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.""" + """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or + inline URLs in your bot's message.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in the sent message""" diff --git a/aiogram/api/types/input_venue_message_content.py b/aiogram/api/types/input_venue_message_content.py index b7488856..2e8c1796 100644 --- a/aiogram/api/types/input_venue_message_content.py +++ b/aiogram/api/types/input_venue_message_content.py @@ -23,4 +23,5 @@ class InputVenueMessageContent(InputMessageContent): foursquare_id: Optional[str] = None """Foursquare identifier of the venue, if known""" foursquare_type: Optional[str] = None - """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" + """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', + 'arts_entertainment/aquarium' or 'food/icecream'.)""" diff --git a/aiogram/api/types/invoice.py b/aiogram/api/types/invoice.py index daba7003..2d8d74ff 100644 --- a/aiogram/api/types/invoice.py +++ b/aiogram/api/types/invoice.py @@ -19,4 +19,7 @@ class Invoice(TelegramObject): currency: str """Three-letter ISO 4217 currency code""" total_amount: int - """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" + """Total price in the smallest units of the currency (integer, not float/double). For example, + for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it + shows the number of digits past the decimal point for each currency (2 for the majority of + currencies).""" diff --git a/aiogram/api/types/keyboard_button.py b/aiogram/api/types/keyboard_button.py index e6818c5e..f2513994 100644 --- a/aiogram/api/types/keyboard_button.py +++ b/aiogram/api/types/keyboard_button.py @@ -7,15 +7,21 @@ from .base import TelegramObject class KeyboardButton(TelegramObject): """ - This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive. - Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + This object represents one button of the reply keyboard. For simple text buttons String can be + used instead of this object to specify text of the button. Optional fields are mutually + exclusive. + Note: request_contact and request_location options will only work in Telegram versions + released after 9 April, 2016. Older clients will ignore them. Source: https://core.telegram.org/bots/api#keyboardbutton """ text: str - """Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed""" + """Text of the button. If none of the optional fields are used, it will be sent as a message + when the button is pressed""" request_contact: Optional[bool] = None - """If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only""" + """If True, the user's phone number will be sent as a contact when the button is pressed. + Available in private chats only""" request_location: Optional[bool] = None - """If True, the user's current location will be sent when the button is pressed. Available in private chats only""" + """If True, the user's current location will be sent when the button is pressed. Available in + private chats only""" diff --git a/aiogram/api/types/labeled_price.py b/aiogram/api/types/labeled_price.py index 59841147..4ef21e54 100644 --- a/aiogram/api/types/labeled_price.py +++ b/aiogram/api/types/labeled_price.py @@ -13,4 +13,7 @@ class LabeledPrice(TelegramObject): label: str """Portion label""" amount: int - """Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" + """Price of the product in the smallest units of the currency (integer, not float/double). For + example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in + currencies.json, it shows the number of digits past the decimal point for each currency (2 + for the majority of currencies).""" diff --git a/aiogram/api/types/login_url.py b/aiogram/api/types/login_url.py index ce063665..cf422252 100644 --- a/aiogram/api/types/login_url.py +++ b/aiogram/api/types/login_url.py @@ -7,7 +7,10 @@ from .base import TelegramObject class LoginUrl(TelegramObject): """ - This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: + This object represents a parameter of the inline keyboard button used to automatically + authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is + coming from Telegram. All the user needs to do is tap/click a button and confirm that they + want to log in: Telegram apps support these buttons as of version 5.7. Sample bot: @discussbot @@ -15,12 +18,16 @@ class LoginUrl(TelegramObject): """ url: str - """An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data. - - NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.""" + """An HTTP URL to be opened with user authorization data added to the query string when the + button is pressed. If the user refuses to provide authorization data, the original URL + without information about the user will be opened. The data added is the same as described + in Receiving authorization data.""" forward_text: Optional[str] = None """New text of the button in forwarded messages.""" bot_username: Optional[str] = None - """Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.""" + """Username of a bot, which will be used for user authorization. See Setting up a bot for more + details. If not specified, the current bot's username will be assumed. The url's domain + must be the same as the domain linked with the bot. See Linking your domain to the bot for + more details.""" request_write_access: Optional[bool] = None """Pass True to request the permission for your bot to send messages to the user.""" diff --git a/aiogram/api/types/mask_position.py b/aiogram/api/types/mask_position.py index 3eea5bda..a9bc365d 100644 --- a/aiogram/api/types/mask_position.py +++ b/aiogram/api/types/mask_position.py @@ -11,10 +11,13 @@ class MaskPosition(TelegramObject): """ point: str - """The part of the face relative to which the mask should be placed. One of 'forehead', 'eyes', 'mouth', or 'chin'.""" + """The part of the face relative to which the mask should be placed. One of 'forehead', + 'eyes', 'mouth', or 'chin'.""" x_shift: float - """Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.""" + """Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. + For example, choosing -1.0 will place mask just to the left of the default mask position.""" y_shift: float - """Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.""" + """Shift by Y-axis measured in heights of the mask scaled to the face size, from top to + bottom. For example, 1.0 will place the mask just below the default mask position.""" scale: float """Mask scaling coefficient. For example, 2.0 means double size.""" diff --git a/aiogram/api/types/message.py b/aiogram/api/types/message.py index 28182575..973a77cd 100644 --- a/aiogram/api/types/message.py +++ b/aiogram/api/types/message.py @@ -8,26 +8,26 @@ from pydantic import Field from .base import TelegramObject if TYPE_CHECKING: - from .voice import Voice + from .photo_size import PhotoSize + from .location import Location from .contact import Contact from .game import Game - from .venue import Venue - from .document import Document - from .audio import Audio - from .invoice import Invoice - from .location import Location - from .photo_size import PhotoSize - from .chat import Chat - from .sticker import Sticker - from .animation import Animation - from .poll import Poll - from .inline_keyboard_markup import InlineKeyboardMarkup - from .user import User from .message_entity import MessageEntity - from .successful_payment import SuccessfulPayment + from .invoice import Invoice + from .animation import Animation + from .venue import Venue + from .user import User from .passport_data import PassportData - from .video import Video from .video_note import VideoNote + from .audio import Audio + from .successful_payment import SuccessfulPayment + from .sticker import Sticker + from .poll import Poll + from .chat import Chat + from .document import Document + from .inline_keyboard_markup import InlineKeyboardMarkup + from .voice import Voice + from .video import Video class Message(TelegramObject): @@ -54,11 +54,13 @@ class Message(TelegramObject): forward_signature: Optional[str] = None """For messages forwarded from channels, signature of the post author if present""" forward_sender_name: Optional[str] = None - """Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages""" + """Sender's name for messages forwarded from users who disallow adding a link to their account + in forwarded messages""" forward_date: Optional[int] = None """For forwarded messages, date the original message was sent in Unix time""" reply_to_message: Optional[Message] = None - """For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.""" + """For replies, the original message. Note that the Message object in this field will not + contain further reply_to_message fields even if it itself is a reply.""" edit_date: Optional[int] = None """Date the message was last edited in Unix time""" media_group_id: Optional[str] = None @@ -68,15 +70,18 @@ class Message(TelegramObject): text: Optional[str] = None """For text messages, the actual UTF-8 text of the message, 0-4096 characters.""" entities: Optional[List[MessageEntity]] = None - """For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text""" + """For text messages, special entities like usernames, URLs, bot commands, etc. that appear in + the text""" caption_entities: Optional[List[MessageEntity]] = None - """For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption""" + """For messages with a caption, special entities like usernames, URLs, bot commands, etc. that + appear in the caption""" audio: Optional[Audio] = None """Message is an audio file, information about the file""" document: Optional[Document] = None """Message is a general file, information about the file""" animation: Optional[Animation] = None - """Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set""" + """Message is an animation, information about the animation. For backward compatibility, when + this field is set, the document field will also be set""" game: Optional[Game] = None """Message is a game, information about the game.""" photo: Optional[List[PhotoSize]] = None @@ -100,9 +105,11 @@ class Message(TelegramObject): poll: Optional[Poll] = None """Message is a native poll, information about the poll""" new_chat_members: Optional[List[User]] = None - """New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)""" + """New members that were added to the group or supergroup and information about them (the bot + itself may be one of these members)""" left_chat_member: Optional[User] = None - """A member was removed from the group, information about them (this member may be the bot itself)""" + """A member was removed from the group, information about them (this member may be the bot + itself)""" new_chat_title: Optional[str] = None """A chat title was changed to this value""" new_chat_photo: Optional[List[PhotoSize]] = None @@ -112,15 +119,28 @@ class Message(TelegramObject): group_chat_created: Optional[bool] = None """Service message: the group has been created""" supergroup_chat_created: Optional[bool] = None - """Service message: the supergroup has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.""" + """Service message: the supergroup has been created. This field can‘t be received in a message + coming through updates, because bot can’t be a member of a supergroup when it is created. + It can only be found in reply_to_message if someone replies to a very first message in a + directly created supergroup.""" channel_chat_created: Optional[bool] = None - """Service message: the channel has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.""" + """Service message: the channel has been created. This field can‘t be received in a message + coming through updates, because bot can’t be a member of a channel when it is created. It + can only be found in reply_to_message if someone replies to a very first message in a + channel.""" migrate_to_chat_id: Optional[int] = None - """The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" + """The group has been migrated to a supergroup with the specified identifier. This number may + be greater than 32 bits and some programming languages may have difficulty/silent defects + in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or + double-precision float type are safe for storing this identifier.""" migrate_from_chat_id: Optional[int] = None - """The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" + """The supergroup has been migrated from a group with the specified identifier. This number + may be greater than 32 bits and some programming languages may have difficulty/silent + defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or + double-precision float type are safe for storing this identifier.""" pinned_message: Optional[Message] = None - """Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.""" + """Specified message was pinned. Note that the Message object in this field will not contain + further reply_to_message fields even if it is itself a reply.""" invoice: Optional[Invoice] = None """Message is an invoice for a payment, information about the invoice.""" successful_payment: Optional[SuccessfulPayment] = None @@ -130,4 +150,5 @@ class Message(TelegramObject): passport_data: Optional[PassportData] = None """Telegram Passport data""" reply_markup: Optional[InlineKeyboardMarkup] = None - """Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.""" + """Inline keyboard attached to the message. login_url buttons are represented as ordinary url + buttons.""" diff --git a/aiogram/api/types/message_entity.py b/aiogram/api/types/message_entity.py index 8dbe6d11..431d57d9 100644 --- a/aiogram/api/types/message_entity.py +++ b/aiogram/api/types/message_entity.py @@ -10,13 +10,17 @@ if TYPE_CHECKING: class MessageEntity(TelegramObject): """ - This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. + This object represents one special entity in a text message. For example, hashtags, usernames, + URLs, etc. Source: https://core.telegram.org/bots/api#messageentity """ type: str - """Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email, phone_number, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames)""" + """Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email, + phone_number, bold (bold text), italic (italic text), code (monowidth string), pre + (monowidth block), text_link (for clickable text URLs), text_mention (for users without + usernames)""" offset: int """Offset in UTF-16 code units to the start of the entity""" length: int diff --git a/aiogram/api/types/passport_data.py b/aiogram/api/types/passport_data.py index 3f627e82..2c732e71 100644 --- a/aiogram/api/types/passport_data.py +++ b/aiogram/api/types/passport_data.py @@ -17,6 +17,7 @@ class PassportData(TelegramObject): """ data: List[EncryptedPassportElement] - """Array with information about documents and other Telegram Passport elements that was shared with the bot""" + """Array with information about documents and other Telegram Passport elements that was shared + with the bot""" credentials: EncryptedCredentials """Encrypted credentials required to decrypt the data""" diff --git a/aiogram/api/types/passport_element_error.py b/aiogram/api/types/passport_element_error.py index 3acdc325..3dcd80a0 100644 --- a/aiogram/api/types/passport_element_error.py +++ b/aiogram/api/types/passport_element_error.py @@ -5,7 +5,8 @@ from .base import TelegramObject class PassportElementError(TelegramObject): """ - This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of: + This object represents an error in the Telegram Passport element which was submitted that + should be resolved by the user. It should be one of: - PassportElementErrorDataField - PassportElementErrorFrontSide - PassportElementErrorReverseSide diff --git a/aiogram/api/types/passport_element_error_data_field.py b/aiogram/api/types/passport_element_error_data_field.py index dab01856..41dcc790 100644 --- a/aiogram/api/types/passport_element_error_data_field.py +++ b/aiogram/api/types/passport_element_error_data_field.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorDataField(PassportElementError): """ - Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. + Represents an issue in one of the data fields that was provided by the user. The error is + considered resolved when the field's value changes. Source: https://core.telegram.org/bots/api#passportelementerrordatafield """ @@ -15,7 +16,8 @@ class PassportElementErrorDataField(PassportElementError): source: str = Field("data", const=True) """Error source, must be data""" type: str - """The section of the user's Telegram Passport which has the error, one of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address'""" + """The section of the user's Telegram Passport which has the error, one of 'personal_details', + 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address'""" field_name: str """Name of the data field which has the error""" data_hash: str diff --git a/aiogram/api/types/passport_element_error_file.py b/aiogram/api/types/passport_element_error_file.py index e2770956..90e4ffd5 100644 --- a/aiogram/api/types/passport_element_error_file.py +++ b/aiogram/api/types/passport_element_error_file.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorFile(PassportElementError): """ - Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. + Represents an issue with a document scan. The error is considered resolved when the file with + the document scan changes. Source: https://core.telegram.org/bots/api#passportelementerrorfile """ @@ -15,7 +16,8 @@ class PassportElementErrorFile(PassportElementError): source: str = Field("file", const=True) """Error source, must be file""" type: str - """The section of the user's Telegram Passport which has the issue, one of 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" + """The section of the user's Telegram Passport which has the issue, one of 'utility_bill', + 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" file_hash: str """Base64-encoded file hash""" message: str diff --git a/aiogram/api/types/passport_element_error_files.py b/aiogram/api/types/passport_element_error_files.py index d3a9cfb2..83507e2a 100644 --- a/aiogram/api/types/passport_element_error_files.py +++ b/aiogram/api/types/passport_element_error_files.py @@ -9,7 +9,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorFiles(PassportElementError): """ - Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. + Represents an issue with a list of scans. The error is considered resolved when the list of + files containing the scans changes. Source: https://core.telegram.org/bots/api#passportelementerrorfiles """ @@ -17,7 +18,8 @@ class PassportElementErrorFiles(PassportElementError): source: str = Field("files", const=True) """Error source, must be files""" type: str - """The section of the user's Telegram Passport which has the issue, one of 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" + """The section of the user's Telegram Passport which has the issue, one of 'utility_bill', + 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" file_hashes: List[str] """List of base64-encoded file hashes""" message: str diff --git a/aiogram/api/types/passport_element_error_front_side.py b/aiogram/api/types/passport_element_error_front_side.py index 2110b595..6c8d40d6 100644 --- a/aiogram/api/types/passport_element_error_front_side.py +++ b/aiogram/api/types/passport_element_error_front_side.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorFrontSide(PassportElementError): """ - Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. + Represents an issue with the front side of a document. The error is considered resolved when + the file with the front side of the document changes. Source: https://core.telegram.org/bots/api#passportelementerrorfrontside """ @@ -15,7 +16,8 @@ class PassportElementErrorFrontSide(PassportElementError): source: str = Field("front_side", const=True) """Error source, must be front_side""" type: str - """The section of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport'""" + """The section of the user's Telegram Passport which has the issue, one of 'passport', + 'driver_license', 'identity_card', 'internal_passport'""" file_hash: str """Base64-encoded hash of the file with the front side of the document""" message: str diff --git a/aiogram/api/types/passport_element_error_reverse_side.py b/aiogram/api/types/passport_element_error_reverse_side.py index bf16ab02..abcb7739 100644 --- a/aiogram/api/types/passport_element_error_reverse_side.py +++ b/aiogram/api/types/passport_element_error_reverse_side.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorReverseSide(PassportElementError): """ - Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. + Represents an issue with the reverse side of a document. The error is considered resolved when + the file with reverse side of the document changes. Source: https://core.telegram.org/bots/api#passportelementerrorreverseside """ @@ -15,7 +16,8 @@ class PassportElementErrorReverseSide(PassportElementError): source: str = Field("reverse_side", const=True) """Error source, must be reverse_side""" type: str - """The section of the user's Telegram Passport which has the issue, one of 'driver_license', 'identity_card'""" + """The section of the user's Telegram Passport which has the issue, one of 'driver_license', + 'identity_card'""" file_hash: str """Base64-encoded hash of the file with the reverse side of the document""" message: str diff --git a/aiogram/api/types/passport_element_error_selfie.py b/aiogram/api/types/passport_element_error_selfie.py index 671bbbff..772d2880 100644 --- a/aiogram/api/types/passport_element_error_selfie.py +++ b/aiogram/api/types/passport_element_error_selfie.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorSelfie(PassportElementError): """ - Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. + Represents an issue with the selfie with a document. The error is considered resolved when the + file with the selfie changes. Source: https://core.telegram.org/bots/api#passportelementerrorselfie """ @@ -15,7 +16,8 @@ class PassportElementErrorSelfie(PassportElementError): source: str = Field("selfie", const=True) """Error source, must be selfie""" type: str - """The section of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport'""" + """The section of the user's Telegram Passport which has the issue, one of 'passport', + 'driver_license', 'identity_card', 'internal_passport'""" file_hash: str """Base64-encoded hash of the file with the selfie""" message: str diff --git a/aiogram/api/types/passport_element_error_translation_file.py b/aiogram/api/types/passport_element_error_translation_file.py index 4423aab7..a9d952e2 100644 --- a/aiogram/api/types/passport_element_error_translation_file.py +++ b/aiogram/api/types/passport_element_error_translation_file.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorTranslationFile(PassportElementError): """ - Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. + Represents an issue with one of the files that constitute the translation of a document. The + error is considered resolved when the file changes. Source: https://core.telegram.org/bots/api#passportelementerrortranslationfile """ @@ -15,7 +16,9 @@ class PassportElementErrorTranslationFile(PassportElementError): source: str = Field("translation_file", const=True) """Error source, must be translation_file""" type: str - """Type of element of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" + """Type of element of the user's Telegram Passport which has the issue, one of 'passport', + 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', + 'rental_agreement', 'passport_registration', 'temporary_registration'""" file_hash: str """Base64-encoded file hash""" message: str diff --git a/aiogram/api/types/passport_element_error_translation_files.py b/aiogram/api/types/passport_element_error_translation_files.py index 254df473..06d90f59 100644 --- a/aiogram/api/types/passport_element_error_translation_files.py +++ b/aiogram/api/types/passport_element_error_translation_files.py @@ -9,7 +9,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorTranslationFiles(PassportElementError): """ - Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. + Represents an issue with the translated version of a document. The error is considered + resolved when a file with the document translation change. Source: https://core.telegram.org/bots/api#passportelementerrortranslationfiles """ @@ -17,7 +18,9 @@ class PassportElementErrorTranslationFiles(PassportElementError): source: str = Field("translation_files", const=True) """Error source, must be translation_files""" type: str - """Type of element of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'""" + """Type of element of the user's Telegram Passport which has the issue, one of 'passport', + 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', + 'rental_agreement', 'passport_registration', 'temporary_registration'""" file_hashes: List[str] """List of base64-encoded file hashes""" message: str diff --git a/aiogram/api/types/passport_element_error_unspecified.py b/aiogram/api/types/passport_element_error_unspecified.py index 9a107dc4..cdccba7d 100644 --- a/aiogram/api/types/passport_element_error_unspecified.py +++ b/aiogram/api/types/passport_element_error_unspecified.py @@ -7,7 +7,8 @@ from .passport_element_error import PassportElementError class PassportElementErrorUnspecified(PassportElementError): """ - Represents an issue in an unspecified place. The error is considered resolved when new data is added. + Represents an issue in an unspecified place. The error is considered resolved when new data is + added. Source: https://core.telegram.org/bots/api#passportelementerrorunspecified """ diff --git a/aiogram/api/types/passport_file.py b/aiogram/api/types/passport_file.py index bbae3db6..ed02e7e1 100644 --- a/aiogram/api/types/passport_file.py +++ b/aiogram/api/types/passport_file.py @@ -5,7 +5,8 @@ from .base import TelegramObject class PassportFile(TelegramObject): """ - This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. + This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport + files are in JPEG format when decrypted and don't exceed 10MB. Source: https://core.telegram.org/bots/api#passportfile """ diff --git a/aiogram/api/types/pre_checkout_query.py b/aiogram/api/types/pre_checkout_query.py index 5947e7e2..4b0fbb79 100644 --- a/aiogram/api/types/pre_checkout_query.py +++ b/aiogram/api/types/pre_checkout_query.py @@ -7,8 +7,8 @@ from pydantic import Field from .base import TelegramObject if TYPE_CHECKING: - from .user import User from .order_info import OrderInfo + from .user import User class PreCheckoutQuery(TelegramObject): @@ -25,7 +25,10 @@ class PreCheckoutQuery(TelegramObject): currency: str """Three-letter ISO 4217 currency code""" total_amount: int - """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" + """Total price in the smallest units of the currency (integer, not float/double). For example, + for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it + shows the number of digits past the decimal point for each currency (2 for the majority of + currencies).""" invoice_payload: str """Bot specified invoice payload""" shipping_option_id: Optional[str] = None diff --git a/aiogram/api/types/reply_keyboard_markup.py b/aiogram/api/types/reply_keyboard_markup.py index 0f8da869..e1dce229 100644 --- a/aiogram/api/types/reply_keyboard_markup.py +++ b/aiogram/api/types/reply_keyboard_markup.py @@ -10,7 +10,8 @@ if TYPE_CHECKING: class ReplyKeyboardMarkup(TelegramObject): """ - This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). + This object represents a custom keyboard with reply options (see Introduction to bots for + details and examples). Source: https://core.telegram.org/bots/api#replykeyboardmarkup """ @@ -18,10 +19,15 @@ class ReplyKeyboardMarkup(TelegramObject): keyboard: List[List[KeyboardButton]] """Array of button rows, each represented by an Array of KeyboardButton objects""" resize_keyboard: Optional[bool] = None - """Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.""" + """Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard + smaller if there are just two rows of buttons). Defaults to false, in which case the custom + keyboard is always of the same height as the app's standard keyboard.""" one_time_keyboard: Optional[bool] = None - """Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.""" + """Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be + available, but clients will automatically display the usual letter-keyboard in the chat – + the user can press a special button in the input field to see the custom keyboard again. + Defaults to false.""" selective: Optional[bool] = None - """Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - - Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.""" + """Use this parameter if you want to show the keyboard to specific users only. Targets: 1) + users that are @mentioned in the text of the Message object; 2) if the bot's message is a + reply (has reply_to_message_id), sender of the original message.""" diff --git a/aiogram/api/types/reply_keyboard_remove.py b/aiogram/api/types/reply_keyboard_remove.py index 86319602..c31a7455 100644 --- a/aiogram/api/types/reply_keyboard_remove.py +++ b/aiogram/api/types/reply_keyboard_remove.py @@ -7,14 +7,19 @@ from .base import TelegramObject class ReplyKeyboardRemove(TelegramObject): """ - Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). + Upon receiving a message with this object, Telegram clients will remove the current custom + keyboard and display the default letter-keyboard. By default, custom keyboards are displayed + until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are + hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Source: https://core.telegram.org/bots/api#replykeyboardremove """ remove_keyboard: bool - """Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)""" + """Requests clients to remove the custom keyboard (user will not be able to summon this + keyboard; if you want to hide the keyboard from sight but keep it accessible, use + one_time_keyboard in ReplyKeyboardMarkup)""" selective: Optional[bool] = None - """Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - - Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.""" + """Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) + users that are @mentioned in the text of the Message object; 2) if the bot's message is a + reply (has reply_to_message_id), sender of the original message.""" diff --git a/aiogram/api/types/response_parameters.py b/aiogram/api/types/response_parameters.py index 37dad468..2e1e4eb8 100644 --- a/aiogram/api/types/response_parameters.py +++ b/aiogram/api/types/response_parameters.py @@ -13,6 +13,10 @@ class ResponseParameters(TelegramObject): """ migrate_to_chat_id: Optional[int] = None - """The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" + """The group has been migrated to a supergroup with the specified identifier. This number may + be greater than 32 bits and some programming languages may have difficulty/silent defects + in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or + double-precision float type are safe for storing this identifier.""" retry_after: Optional[int] = None - """In case of exceeding flood control, the number of seconds left to wait before the request can be repeated""" + """In case of exceeding flood control, the number of seconds left to wait before the request + can be repeated""" diff --git a/aiogram/api/types/shipping_query.py b/aiogram/api/types/shipping_query.py index 8138ad66..8b6e2ea4 100644 --- a/aiogram/api/types/shipping_query.py +++ b/aiogram/api/types/shipping_query.py @@ -7,8 +7,8 @@ from pydantic import Field from .base import TelegramObject if TYPE_CHECKING: - from .shipping_address import ShippingAddress from .user import User + from .shipping_address import ShippingAddress class ShippingQuery(TelegramObject): diff --git a/aiogram/api/types/successful_payment.py b/aiogram/api/types/successful_payment.py index e33ca37c..cb31356b 100644 --- a/aiogram/api/types/successful_payment.py +++ b/aiogram/api/types/successful_payment.py @@ -18,7 +18,10 @@ class SuccessfulPayment(TelegramObject): currency: str """Three-letter ISO 4217 currency code""" total_amount: int - """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" + """Total price in the smallest units of the currency (integer, not float/double). For example, + for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it + shows the number of digits past the decimal point for each currency (2 for the majority of + currencies).""" invoice_payload: str """Bot specified invoice payload""" telegram_payment_charge_id: str diff --git a/aiogram/api/types/update.py b/aiogram/api/types/update.py index fc82a4c2..57351a8b 100644 --- a/aiogram/api/types/update.py +++ b/aiogram/api/types/update.py @@ -5,13 +5,13 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject if TYPE_CHECKING: - from .callback_query import CallbackQuery from .inline_query import InlineQuery from .shipping_query import ShippingQuery + from .message import Message + from .callback_query import CallbackQuery + from .poll import Poll from .pre_checkout_query import PreCheckoutQuery from .chosen_inline_result import ChosenInlineResult - from .message import Message - from .poll import Poll class Update(TelegramObject): @@ -23,7 +23,11 @@ class Update(TelegramObject): """ update_id: int - """The update‘s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.""" + """The update‘s unique identifier. Update identifiers start from a certain positive number and + increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it + allows you to ignore repeated updates or to restore the correct update sequence, should + they get out of order. If there are no new updates for at least a week, then identifier of + the next update will be chosen randomly instead of sequentially.""" message: Optional[Message] = None """New incoming message of any kind — text, photo, sticker, etc.""" edited_message: Optional[Message] = None @@ -35,7 +39,9 @@ class Update(TelegramObject): inline_query: Optional[InlineQuery] = None """New incoming inline query""" chosen_inline_result: Optional[ChosenInlineResult] = None - """The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.""" + """The result of an inline query that was chosen by a user and sent to their chat partner. + Please see our documentation on the feedback collecting for details on how to enable these + updates for your bot.""" callback_query: Optional[CallbackQuery] = None """New incoming callback query""" shipping_query: Optional[ShippingQuery] = None @@ -43,4 +49,5 @@ class Update(TelegramObject): pre_checkout_query: Optional[PreCheckoutQuery] = None """New incoming pre-checkout query. Contains full information about checkout""" poll: Optional[Poll] = None - """New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot""" + """New poll state. Bots receive only updates about stopped polls and polls, which are sent by + the bot""" diff --git a/aiogram/api/types/venue.py b/aiogram/api/types/venue.py index 0c844480..f2853b05 100644 --- a/aiogram/api/types/venue.py +++ b/aiogram/api/types/venue.py @@ -24,4 +24,5 @@ class Venue(TelegramObject): foursquare_id: Optional[str] = None """Foursquare identifier of the venue""" foursquare_type: Optional[str] = None - """Foursquare type of the venue. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" + """Foursquare type of the venue. (For example, 'arts_entertainment/default', + 'arts_entertainment/aquarium' or 'food/icecream'.)""" diff --git a/aiogram/api/types/webhook_info.py b/aiogram/api/types/webhook_info.py index 3149ea12..febcb465 100644 --- a/aiogram/api/types/webhook_info.py +++ b/aiogram/api/types/webhook_info.py @@ -19,9 +19,11 @@ class WebhookInfo(TelegramObject): pending_update_count: int """Number of updates awaiting delivery""" last_error_date: Optional[int] = None - """Unix time for the most recent error that happened when trying to deliver an update via webhook""" + """Unix time for the most recent error that happened when trying to deliver an update via + webhook""" last_error_message: Optional[str] = None - """Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook""" + """Error message in human-readable format for the most recent error that happened when trying + to deliver an update via webhook""" max_connections: Optional[int] = None """Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery""" allowed_updates: Optional[List[str]] = None