diff --git a/.gitignore b/.gitignore index 43d848ee..e4189c4f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__/ env/ build/ +_build/ dist/ site/ *.egg-info/ diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..52cc251d --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,12 @@ +version: 2 + +sphinx: + configuration: docs2/source/conf.py + +formats: all + +python: + version: 3.8 + install: + - method: pip + path: . diff --git a/aiogram/api/client/bot.py b/aiogram/api/client/bot.py index 5a78e589..526fa56b 100644 --- a/aiogram/api/client/bot.py +++ b/aiogram/api/client/bot.py @@ -131,13 +131,20 @@ T = TypeVar("T") class Bot(ContextInstanceMixin["Bot"]): - """ - Main bot class - """ - def __init__( self, token: str, session: Optional[BaseSession] = None, parse_mode: Optional[str] = None, ) -> None: + """ + Bot class + + :param token: Telegram Bot token `Obtained from @BotFather `_ + :param session: HTTP Client session (For example AiohttpSession). + If not specified it will be automatically created. + :param parse_mode: Default parse mode. + If specified it will be propagated into the API methods at runtime. + :raise TokenValidationError: When token has invalid format this exception will be raised + """ + validate_token(token) if session is None: @@ -327,23 +334,23 @@ class Bot(ContextInstanceMixin["Bot"]): 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. + 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. + 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. + polling. Should be positive, short polling should be used for testing + purposes only. :param allowed_updates: A JSON-serialized list of the update types 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. + 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. :param request_timeout: Request timeout :return: An Array of Update objects is returned. """ @@ -380,19 +387,19 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#setwebhook :param url: HTTPS url to send updates to. Use an empty string to remove webhook - integration + 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. + 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. + 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: A JSON-serialized list of the update types 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. + 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. :param request_timeout: Request timeout :return: Returns True on success. """ @@ -427,7 +434,7 @@ class Bot(ContextInstanceMixin["Bot"]): :param request_timeout: Request timeout :return: On success, returns a WebhookInfo object. If the bot is using getUpdates, will - return an object with the url field empty. + return an object with the url field empty. """ call = GetWebhookInfo() return await self(call, request_timeout=request_timeout) @@ -469,17 +476,17 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param text: Text of the message to be sent, 1-4096 characters after entities parsing :param parse_mode: Mode for parsing entities in the message text. See formatting options - for more details. + for more details. :param disable_web_page_preview: Disables link previews for links in this message :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -508,12 +515,12 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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) + (or channel username in the format @channelusername) :param message_id: Message identifier in the chat specified in from_chat_id :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -544,21 +551,21 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 after entities parsing + characters after entities parsing :param parse_mode: Mode for parsing entities in the photo caption. See formatting options - for more details. + for more details. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -600,30 +607,30 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 after entities parsing :param parse_mode: Mode for parsing entities in the audio caption. See formatting options - for more details. + for more details. :param duration: Duration of the audio in seconds :param performer: Performer :param title: Track name :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the - file is supported server-side. The thumbnail should be in JPEG format and - less than 200 kB in size. A thumbnail's width and height should not exceed - 320. Ignored if the file is not uploaded using multipart/form-data. - Thumbnails can't be reused and can be only uploaded as a new file, so you - can pass 'attach://' if the thumbnail was uploaded using - multipart/form-data under . + 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. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -664,28 +671,28 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 . + 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 after entities parsing + 0-1024 characters after entities parsing :param parse_mode: Mode for parsing entities in the document caption. See formatting - options for more details. + options for more details. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -727,32 +734,32 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 :param width: Video width :param height: Video height :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the - file is supported server-side. The thumbnail should be in JPEG format and - less than 200 kB in size. A thumbnail's width and height should not exceed - 320. Ignored if the file is not uploaded using multipart/form-data. - Thumbnails can't be reused and can be only uploaded as a new file, so you - can pass 'attach://' if the thumbnail was uploaded using - multipart/form-data under . + 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 after entities parsing + characters after entities parsing :param parse_mode: Mode for parsing entities in the video caption. See formatting options - for more details. + for more details. :param supports_streaming: Pass True, if the uploaded video is suitable for streaming :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -797,31 +804,31 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 :param width: Animation width :param height: Animation height :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the - file is supported server-side. The thumbnail should be in JPEG format and - less than 200 kB in size. A thumbnail's width and height should not exceed - 320. Ignored if the file is not uploaded using multipart/form-data. - Thumbnails can't be reused and can be only uploaded as a new file, so you - can pass 'attach://' if the thumbnail was uploaded using - multipart/form-data under . + 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 after entities parsing + 0-1024 characters after entities parsing :param parse_mode: Mode for parsing entities in the animation caption. See formatting - options for more details. + options for more details. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -864,21 +871,21 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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 after entities parsing :param parse_mode: Mode for parsing entities in the voice message caption. See formatting - options for more details. + options for more details. :param duration: Duration of the voice message in seconds :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -915,26 +922,26 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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 + 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 :param length: Video width and height, i.e. diameter of the video message :param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the - file is supported server-side. The thumbnail should be in JPEG format and - less than 200 kB in size. A thumbnail's width and height should not exceed - 320. Ignored if the file is not uploaded using multipart/form-data. - Thumbnails can't be reused and can be only uploaded as a new file, so you - can pass 'attach://' if the thumbnail was uploaded using - multipart/form-data under . + 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. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -965,11 +972,11 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param media: A JSON-serialized array describing photos and videos to be sent, must - include 2-10 items + include 2-10 items :param disable_notification: Sends the messages silently. Users will receive a - notification with no sound. + notification with no sound. :param reply_to_message_id: If the messages are a reply, ID of the original message :param request_timeout: Request timeout :return: On success, an array of the sent Messages is returned. @@ -1001,17 +1008,17 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param latitude: Latitude of the location :param longitude: Longitude of the location :param live_period: Period in seconds for which the location will be updated (see Live - Locations, should be between 60 and 86400. + Locations, should be between 60 and 86400. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -1047,16 +1054,16 @@ class Bot(ContextInstanceMixin["Bot"]): :param latitude: Latitude of new location :param longitude: Longitude of new location :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) + 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 + message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. :param request_timeout: Request timeout :return: On success, if the edited message was sent by the bot, the edited Message is - returned, otherwise True is returned. + returned, otherwise True is returned. """ call = EditMessageLiveLocation( latitude=latitude, @@ -1084,16 +1091,16 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + 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 + 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 + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. :param request_timeout: Request timeout :return: On success, if the message was sent by the bot, the sent Message is returned, - otherwise True is returned. + otherwise True is returned. """ call = StopMessageLiveLocation( chat_id=chat_id, @@ -1126,21 +1133,21 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param latitude: Latitude of the venue :param longitude: Longitude of the venue :param title: Name of the venue :param address: Address of the venue :param foursquare_id: Foursquare identifier of the venue :param foursquare_type: Foursquare type of the venue, if known. (For example, - 'arts_entertainment/default', 'arts_entertainment/aquarium' or - 'food/icecream'.) + 'arts_entertainment/default', 'arts_entertainment/aquarium' or + 'food/icecream'.) :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -1178,17 +1185,17 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param phone_number: Contact's phone number :param first_name: Contact's first name :param last_name: Contact's last name :param vcard: Additional data about the contact in the form of a vCard, 0-2048 bytes :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove keyboard or + to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -1231,34 +1238,34 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param question: Poll question, 1-255 characters :param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters - each + each :param is_anonymous: True, if the poll needs to be anonymous, defaults to True :param type: Poll type, 'quiz' or 'regular', defaults to 'regular' :param allows_multiple_answers: True, if the poll allows multiple answers, ignored for - polls in quiz mode, defaults to False + polls in quiz mode, defaults to False :param correct_option_id: 0-based identifier of the correct answer option, required for - polls in quiz mode + polls in quiz mode :param explanation: Text that is shown when a user chooses an incorrect answer or taps on - the lamp icon in a quiz-style poll, 0-200 characters with at most 2 - line feeds after entities parsing + the lamp icon in a quiz-style poll, 0-200 characters with at most 2 + line feeds after entities parsing :param explanation_parse_mode: Mode for parsing entities in the explanation. See - formatting options for more details. + formatting options for more details. :param open_period: Amount of time in seconds the poll will be active after creation, - 5-600. Can't be used together with close_date. + 5-600. Can't be used together with close_date. :param close_date: Point in time (Unix timestamp) when the poll will be automatically - closed. Must be at least 5 and no more than 600 seconds in the future. - Can't be used together with open_period. + closed. Must be at least 5 and no more than 600 seconds in the future. + Can't be used together with open_period. :param is_closed: Pass True, if the poll needs to be immediately closed. This can be - useful for poll preview. + useful for poll preview. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -1299,16 +1306,16 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#senddice :param chat_id: Unique identifier for the target chat or username of the target channel - (in the format @channelusername) + (in the format @channelusername) :param emoji: Emoji on which the dice throw animation is based. Currently, must be one of - '', '', or ''. Dice can have values 1-6 for '' and '', and values 1-5 for - ''. Defaults to '' + '', '', or ''. Dice can have values 1-6 for '' and '', and values 1-5 for + ''. Defaults to '' :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -1338,12 +1345,12 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (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. + 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. :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1365,9 +1372,9 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: Unique identifier of the target user :param offset: Sequential number of the first photo to be returned. By default, all photos - are returned. + are returned. :param limit: Limits the number of photos to be retrieved. Values between 1-100 are - accepted. Defaults to 100. + accepted. Defaults to 100. :param request_timeout: Request timeout :return: Returns a UserProfilePhotos object. """ @@ -1410,14 +1417,14 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + supergroup or channel (in the format @channelusername) :param user_id: Unique identifier of the target user :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 + more than 366 days or less than 30 seconds from the current time they + are considered to be banned forever :param request_timeout: Request timeout :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. + 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(call, request_timeout=request_timeout) @@ -1433,11 +1440,11 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + supergroup or channel (in the format @username) :param user_id: Unique identifier of the target user :param request_timeout: Request timeout :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. + to join via link, etc. Returns True on success. """ call = UnbanChatMember(chat_id=chat_id, user_id=user_id,) return await self(call, request_timeout=request_timeout) @@ -1458,12 +1465,12 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @supergroupusername) :param user_id: Unique identifier of the target user :param permissions: New user permissions :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 + is restricted for more than 366 days or less than 30 seconds from the + current time, they are considered to be restricted forever :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1494,25 +1501,25 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param user_id: Unique identifier of the target user :param can_change_info: Pass True, if the administrator can change chat title, photo and - other settings + other settings :param can_post_messages: Pass True, if the administrator can create channel posts, - channels only + channels only :param can_edit_messages: Pass True, if the administrator can edit messages of other users - and can pin messages, channels only + and can pin messages, channels only :param can_delete_messages: Pass True, if the administrator can delete messages of other - users + users :param can_invite_users: Pass True, if the administrator can invite new users to the chat :param can_restrict_members: Pass True, if the administrator can restrict, ban or unban - chat members + chat members :param can_pin_messages: Pass True, if the administrator can pin messages, supergroups - only + only :param can_promote_members: Pass True, if the administrator can add new administrators - with a subset of their own privileges or demote administrators - that he has promoted, directly or indirectly (promoted by - administrators that were appointed by him) + with a subset of their own privileges or demote administrators + that he has promoted, directly or indirectly (promoted by + administrators that were appointed by him) :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1544,10 +1551,10 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle :param chat_id: Unique identifier for the target chat or username of the target supergroup - (in the format @supergroupusername) + (in the format @supergroupusername) :param user_id: Unique identifier of the target user :param custom_title: New custom title for the administrator; 0-16 characters, emoji are - not allowed + not allowed :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1570,7 +1577,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @supergroupusername) :param permissions: New default chat permissions :param request_timeout: Request timeout :return: Returns True on success. @@ -1594,7 +1601,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param request_timeout: Request timeout :return: Returns the new invite link as String on success. """ @@ -1612,7 +1619,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param photo: New chat photo, uploaded using multipart/form-data :param request_timeout: Request timeout :return: Returns True on success. @@ -1631,7 +1638,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1649,7 +1656,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param title: New chat title, 1-255 characters :param request_timeout: Request timeout :return: Returns True on success. @@ -1671,7 +1678,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param description: New chat description, 0-255 characters :param request_timeout: Request timeout :return: Returns True on success. @@ -1695,11 +1702,11 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param message_id: Identifier of a message to pin :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. + all chat members about the new pinned message. Notifications + are always disabled in channels. :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1720,7 +1727,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1737,7 +1744,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + or channel (in the format @channelusername) :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1755,7 +1762,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + or channel (in the format @channelusername) :param request_timeout: Request timeout :return: Returns a Chat object on success. """ @@ -1774,12 +1781,12 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + or channel (in the format @channelusername) :param request_timeout: Request timeout :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. + 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(call, request_timeout=request_timeout) @@ -1793,7 +1800,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + or channel (in the format @channelusername) :param request_timeout: Request timeout :return: Returns Int on success. """ @@ -1810,7 +1817,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + or channel (in the format @channelusername) :param user_id: Unique identifier of the target user :param request_timeout: Request timeout :return: Returns a ChatMember object on success. @@ -1833,11 +1840,11 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @supergroupusername) :param sticker_set_name: Name of the sticker set to be set as the group sticker set :param request_timeout: Request timeout :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. + 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(call, request_timeout=request_timeout) @@ -1854,10 +1861,10 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @supergroupusername) :param request_timeout: Request timeout :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. + check if the bot can use this method. Returns True on success. """ call = DeleteChatStickerSet(chat_id=chat_id,) return await self(call, request_timeout=request_timeout) @@ -1884,15 +1891,15 @@ class Bot(ContextInstanceMixin["Bot"]): :param callback_query_id: Unique identifier for the query to be answered :param text: Text of the notification. If not specified, nothing will be shown to the - user, 0-200 characters + 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. + 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. + 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. + query may be cached client-side. Telegram apps will support caching + starting in version 3.14. Defaults to 0. :param request_timeout: Request timeout :return: On success, True is returned. """ @@ -1914,7 +1921,7 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#setmycommands :param commands: A JSON-serialized list of bot commands to be set as the list of the bot's - commands. At most 100 commands can be specified. + commands. At most 100 commands can be specified. :param request_timeout: Request timeout :return: Returns True on success. """ @@ -1958,19 +1965,19 @@ class Bot(ContextInstanceMixin["Bot"]): :param text: New text of the message, 1-4096 characters after entities parsing :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) + 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 + message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param parse_mode: Mode for parsing entities in the message text. See formatting options - for more details. + for more details. :param disable_web_page_preview: Disables link previews for links in this message :param reply_markup: A JSON-serialized object for an inline keyboard. :param request_timeout: Request timeout :return: On success, if edited message is sent by the bot, the edited Message is returned, - otherwise True is returned. + otherwise True is returned. """ call = EditMessageText( text=text, @@ -2000,19 +2007,19 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + 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 + message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param caption: New caption of the message, 0-1024 characters after entities parsing :param parse_mode: Mode for parsing entities in the message caption. See formatting - options for more details. + options for more details. :param reply_markup: A JSON-serialized object for an inline keyboard. :param request_timeout: Request timeout :return: On success, if edited message is sent by the bot, the edited Message is returned, - otherwise True is returned. + otherwise True is returned. """ call = EditMessageCaption( chat_id=chat_id, @@ -2045,16 +2052,16 @@ class Bot(ContextInstanceMixin["Bot"]): :param media: A JSON-serialized object for a new media content of the message :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) + 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 + message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param reply_markup: A JSON-serialized object for a new inline keyboard. :param request_timeout: Request timeout :return: On success, if the edited message was sent by the bot, the edited Message is - returned, otherwise True is returned. + returned, otherwise True is returned. """ call = EditMessageMedia( media=media, @@ -2080,16 +2087,16 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + 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 + message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param reply_markup: A JSON-serialized object for an inline keyboard. :param request_timeout: Request timeout :return: On success, if edited message is sent by the bot, the edited Message is returned, - otherwise True is returned. + otherwise True is returned. """ call = EditMessageReplyMarkup( chat_id=chat_id, @@ -2113,7 +2120,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param message_id: Identifier of the original message with the poll :param reply_markup: A JSON-serialized object for a new message inline keyboard. :param request_timeout: Request timeout @@ -2142,7 +2149,7 @@ class Bot(ContextInstanceMixin["Bot"]): 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) + (in the format @channelusername) :param message_id: Identifier of the message to delete :param request_timeout: Request timeout :return: Returns True on success. @@ -2173,17 +2180,17 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#sendsticker :param chat_id: Unique identifier for the target chat or username of the target channel - (in the format @channelusername) + (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. + 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. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + keyboard, custom reply keyboard, instructions to remove reply + keyboard or to force a reply from the user. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -2223,8 +2230,8 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: User identifier of sticker file owner :param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, - dimensions must not exceed 512px, and either width or height must be - exactly 512px. + dimensions must not exceed 512px, and either width or height must be + exactly 512px. :param request_timeout: Request timeout :return: Returns the uploaded File on success. """ @@ -2252,23 +2259,23 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: User identifier of created sticker set owner :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. + 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 :param emojis: One or more emoji corresponding to the sticker :param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, - dimensions must not exceed 512px, and either width or height must be - exactly 512px. Pass a file_id as a String to send a file that already - exists on the Telegram servers, pass an HTTP URL as a String for - Telegram to get a file from the Internet, or upload a new one using - multipart/form-data. + 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 tgs_sticker: TGS animation with the sticker, uploaded using multipart/form-data. - See https://core.telegram.org/animated_stickers#technical-requirements - for technical requirements + See https://core.telegram.org/animated_stickers#technical-requirements + for technical requirements :param contains_masks: Pass True, if a set of mask stickers should be created :param mask_position: A JSON-serialized object for position where the mask should be - placed on faces + placed on faces :param request_timeout: Request timeout :return: Returns True on success. """ @@ -2306,16 +2313,16 @@ class Bot(ContextInstanceMixin["Bot"]): :param name: Sticker set name :param emojis: One or more emoji corresponding to the sticker :param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, - dimensions must not exceed 512px, and either width or height must be - exactly 512px. Pass a file_id as a String to send a file that already - exists on the Telegram servers, pass an HTTP URL as a String for - Telegram to get a file from the Internet, or upload a new one using - multipart/form-data. + 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 tgs_sticker: TGS animation with the sticker, uploaded using multipart/form-data. - See https://core.telegram.org/animated_stickers#technical-requirements - for technical requirements + See https://core.telegram.org/animated_stickers#technical-requirements + for technical requirements :param mask_position: A JSON-serialized object for position where the mask should be - placed on faces + placed on faces :param request_timeout: Request timeout :return: Returns True on success. """ @@ -2378,14 +2385,14 @@ class Bot(ContextInstanceMixin["Bot"]): :param name: Sticker set name :param user_id: User identifier of the sticker set owner :param thumb: A PNG image with the thumbnail, must be up to 128 kilobytes in size and have - width and height exactly 100px, or a TGS animation with the thumbnail up to - 32 kilobytes in size; see - https://core.telegram.org/animated_stickers#technical-requirements for - animated sticker technical requirements. Pass a file_id as a String to send - a file that already exists on the Telegram servers, pass an HTTP URL as a - String for Telegram to get a file from the Internet, or upload a new one - using multipart/form-data.. Animated sticker set thumbnail can't be uploaded - via HTTP URL. + width and height exactly 100px, or a TGS animation with the thumbnail up to + 32 kilobytes in size; see + https://core.telegram.org/animated_stickers#technical-requirements for + animated sticker technical requirements. Pass a file_id as a String to send + a file that already exists on the Telegram servers, pass an HTTP URL as a + String for Telegram to get a file from the Internet, or upload a new one + using multipart/form-data.. Animated sticker set thumbnail can't be uploaded + via HTTP URL. :param request_timeout: Request timeout :return: Returns True on success. """ @@ -2417,20 +2424,20 @@ class Bot(ContextInstanceMixin["Bot"]): :param inline_query_id: Unique identifier for the answered query :param results: A JSON-serialized array of results for the inline query :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. + 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 + 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. + 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 + 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. + when user presses the switch button. 1-64 characters, only + A-Z, a-z, 0-9, _ and - are allowed. :param request_timeout: Request timeout :return: On success, True is returned. """ @@ -2486,40 +2493,40 @@ class Bot(ContextInstanceMixin["Bot"]): :param title: Product name, 1-32 characters :param description: Product description, 1-255 characters :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to - the user, use for your internal processes. + the user, use for your internal processes. :param provider_token: Payments provider token, obtained via Botfather :param start_parameter: Unique deep-linking parameter that can be used to generate this - invoice when used as a start parameter + invoice when used as a start parameter :param currency: Three-letter ISO 4217 currency code, see more on currencies :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, - tax, discount, delivery cost, delivery tax, bonus, etc.) + 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. + 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. + a marketing image for a service. People like it better when they see + what they are paying for. :param photo_size: Photo size :param photo_width: Photo width :param photo_height: Photo height :param need_name: Pass True, if you require the user's full name to complete the order :param need_phone_number: Pass True, if you require the user's phone number to complete - the order + the order :param need_email: Pass True, if you require the user's email address to complete the - order + order :param need_shipping_address: Pass True, if you require the user's shipping address to - complete the order + complete the order :param send_phone_number_to_provider: Pass True, if user's phone number should be sent to - provider + provider :param send_email_to_provider: Pass True, if user's email address should be sent to - provider + provider :param is_flexible: Pass True, if the final price depends on the shipping method :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + total price' button will be shown. If not empty, the first button + must be a Pay button. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -2567,14 +2574,14 @@ class Bot(ContextInstanceMixin["Bot"]): :param shipping_query_id: Unique identifier for the query to be answered :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) + 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. + 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. + explains why it is impossible to complete the order (e.g. "Sorry, + delivery to your desired address is unavailable'). Telegram will + display this message to the user. :param request_timeout: Request timeout :return: On success, True is returned. """ @@ -2603,13 +2610,13 @@ class Bot(ContextInstanceMixin["Bot"]): :param pre_checkout_query_id: Unique identifier for the query to be answered :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. + 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. + 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. :param request_timeout: Request timeout :return: On success, True is returned. """ @@ -2645,8 +2652,8 @@ class Bot(ContextInstanceMixin["Bot"]): :param errors: A JSON-serialized array describing the errors :param request_timeout: Request timeout :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. + 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(call, request_timeout=request_timeout) @@ -2672,13 +2679,13 @@ class Bot(ContextInstanceMixin["Bot"]): :param chat_id: Unique identifier for the target chat :param game_short_name: Short name of the game, serves as the unique identifier for the - game. Set up your games via Botfather. + game. Set up your games via Botfather. :param disable_notification: Sends the message silently. Users will receive a notification - with no sound. + with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message :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. + game_title' button will be shown. If not empty, the first button must + launch the game. :param request_timeout: Request timeout :return: On success, the sent Message is returned. """ @@ -2713,19 +2720,19 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: User identifier :param score: New score, must be non-negative :param force: Pass True, if the high score is allowed to decrease. This can be useful when - fixing mistakes or banning cheaters + 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 + edited to include the current scoreboard :param chat_id: Required if inline_message_id is not specified. Unique identifier for the - target chat + target chat :param message_id: Required if inline_message_id is not specified. Identifier of the sent - message + message :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param request_timeout: Request timeout :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. + 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, @@ -2758,17 +2765,17 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: Target user id :param chat_id: Required if inline_message_id is not specified. Unique identifier for the - target chat + target chat :param message_id: Required if inline_message_id is not specified. Identifier of the sent - message + message :param inline_message_id: Required if chat_id and message_id are not specified. Identifier - of the inline message + of the inline message :param request_timeout: Request timeout :return: Will return the score of the specified user and several of their 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 their closest neighbors - on each side. Will also return the top three users if the user and his neighbors - are not among them. + game. On success, returns an Array of GameHighScore objects. This method will + currently return scores for the target user, plus two of their 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/client/session/base.py b/aiogram/api/client/session/base.py index d1249733..d8a030be 100644 --- a/aiogram/api/client/session/base.py +++ b/aiogram/api/client/session/base.py @@ -32,35 +32,63 @@ _JsonDumps = Callable[..., str] class BaseSession(abc.ABC): - default_timeout: ClassVar[float] = 60.0 api: Default[TelegramAPIServer] = Default(PRODUCTION) + """Telegra Bot API URL patterns""" json_loads: Default[_JsonLoads] = Default(json.loads) + """JSON loader""" json_dumps: Default[_JsonDumps] = Default(json.dumps) + """JSON dumper""" + default_timeout: ClassVar[float] = 60.0 + """Default timeout""" timeout: Default[float] = Default(fget=lambda self: float(self.__class__.default_timeout)) + """Session scope request timeout""" @classmethod def raise_for_status(cls, response: Response[T]) -> None: + """ + Check response status + + :param response: Response instance + """ if response.ok: return raise TelegramAPIError(response.description) @abc.abstractmethod async def close(self) -> None: # pragma: no cover + """ + Close client session + """ pass @abc.abstractmethod async def make_request( self, bot: Bot, method: TelegramMethod[T], timeout: Optional[int] = UNSET ) -> T: # pragma: no cover + """ + Make request to Telegram Bot API + + :param bot: Bot instance + :param method: Method instance + :param timeout: Request timeout + :return: + :raise TelegramApiError: + """ pass @abc.abstractmethod async def stream_content( self, url: str, timeout: int, chunk_size: int ) -> AsyncGenerator[bytes, None]: # pragma: no cover + """ + Stream reader + """ yield b"" def prepare_value(self, value: Any) -> Union[str, int, bool]: + """ + Prepare value before send + """ if isinstance(value, str): return value if isinstance(value, (list, dict)): @@ -74,6 +102,9 @@ class BaseSession(abc.ABC): return str(value) def clean_json(self, value: Any) -> Any: + """ + Clean data before send + """ if isinstance(value, list): return [self.clean_json(v) for v in value if v is not None] elif isinstance(value, dict): diff --git a/aiogram/api/types/input_file.py b/aiogram/api/types/input_file.py index 86d7c62a..4006606a 100644 --- a/aiogram/api/types/input_file.py +++ b/aiogram/api/types/input_file.py @@ -38,6 +38,13 @@ class InputFile(ABC): class BufferedInputFile(InputFile): def __init__(self, file: bytes, filename: str, chunk_size: int = DEFAULT_CHUNK_SIZE): + """ + Represents object for uploading files from filesystem + + :param file: Bytes + :param filename: Filename to be propagated to telegram. + :param chunk_size: Uploading chunk size + """ super().__init__(filename=filename, chunk_size=chunk_size) self.data = file @@ -49,6 +56,15 @@ class BufferedInputFile(InputFile): filename: Optional[str] = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ) -> BufferedInputFile: + """ + Create buffer from file + + :param path: Path to file + :param filename: Filename to be propagated to telegram. + By default will be parsed from path + :param chunk_size: Uploading chunk size + :return: instance of :obj:`BufferedInputFile` + """ if filename is None: filename = os.path.basename(path) with open(path, "rb") as f: @@ -70,6 +86,14 @@ class FSInputFile(InputFile): filename: Optional[str] = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ): + """ + Represents object for uploading files from filesystem + + :param path: Path to file + :param filename: Filename to be propagated to telegram. + By default will be parsed from path + :param chunk_size: Uploading chunk size + """ if filename is None: filename = os.path.basename(path) super().__init__(filename=filename, chunk_size=chunk_size) @@ -92,6 +116,13 @@ class URLInputFile(InputFile): chunk_size: int = DEFAULT_CHUNK_SIZE, timeout: int = 30, ): + """ + Represents object for streaming files from internet + + :param url: URL in internet + :param filename: Filename to be propagated to telegram. + :param chunk_size: Uploading chunk size + """ super().__init__(filename=filename, chunk_size=chunk_size) self.url = url diff --git a/docs2/Makefile b/docs2/Makefile new file mode 100644 index 00000000..84ae0cb1 --- /dev/null +++ b/docs2/Makefile @@ -0,0 +1,24 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SPHINXINTL ?= sphinx-intl +SOURCEDIR = source +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +update-intl: gettext + $(SPHINXINTL) update -p $(BUILDDIR)/gettext $(O) + +.PHONY: help update-intl Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs2/make.bat b/docs2/make.bat new file mode 100644 index 00000000..9534b018 --- /dev/null +++ b/docs2/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs2/source/_static/logo.png b/docs2/source/_static/logo.png new file mode 100755 index 00000000..b363701d Binary files /dev/null and b/docs2/source/_static/logo.png differ diff --git a/docs2/source/api/bot.rst b/docs2/source/api/bot.rst new file mode 100644 index 00000000..a29ad6b1 --- /dev/null +++ b/docs2/source/api/bot.rst @@ -0,0 +1,14 @@ +### +Bot +### + +Bot instance can be created from :code:`aiogram.Bot` (:code:`from aiogram import Bot`) and +you can't use API methods without instance of bot with configured token. + +This class has aliases for all API methods and named in :code:`lower_camel_case`. + +For example :code:`sendMessage` named :code:`send_message` and has the same specification with all class-based methods. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: + :show-inheritance: diff --git a/docs2/source/api/download_file.rst b/docs2/source/api/download_file.rst new file mode 100644 index 00000000..028eb723 --- /dev/null +++ b/docs2/source/api/download_file.rst @@ -0,0 +1,97 @@ +##################### +How to download file? +##################### + +Download file manually +====================== + +First, you must get the `file_id` of the file you want to download. +Information about files sent to the bot is contained in `Message `__. + +For example, download the document that came to the bot. + +.. code-block:: + file_id = message.document.file_id + +Then use the `getFile `__ method to get `file_path`. + +.. code-block:: + + file = await bot.get_file(file_id) + file_path = file.file_path + +After that, use the `download_file <#download-file>`__ method from the bot object. + +download_file(...) +------------------ + +Download file by `file_path` to destination. + +If you want to automatically create destination (:obj:`io.BytesIO`) use default +value of destination and handle result of this method. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: download_file + :exclude-members: __init__ + +There are two options where you can download the file: to **disk** or to **binary I/O object**. + +Download file to disk +--------------------- + +To download file to disk, you must specify the file name or path where to download the file. +In this case, the function will return nothing. + +.. code-block:: + + await bot.download_file(file_path, "text.txt") + +Download file to binary I/O object +---------------------------------- + +To download file to binary I/O object, you must specify an object with the +:obj:`typing.BinaryIO` type or use the default (:obj:`None`) value. + +In the first case, the function will return your object: + +.. code-block:: + + my_object = MyBinaryIO() + result: MyBinaryIO = await bot.download_file(file_path, my_object) + # print(result is my_object) # True + +If you leave the default value, an :obj:`io.BytesIO` object will be created and returned. + +.. code-block:: + + result: io.BytesIO = await bot.download_file(file_path) + + +Download file in short way +========================== + +Getting `file_path` manually every time is boring, so you should use the `download <#download>`__ method. + +download(...) +------------- + +Download file by `file_id` or `Downloadable` object to destination. + +If you want to automatically create destination (:obj:`io.BytesIO`) use default +value of destination and handle result of this method. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: download + :exclude-members: __init__ + +It differs from `download_file <#download-file>`__ **only** in that it accepts `file_id` +or an `Downloadable` object (object that contains the `file_id` attribute) instead of `file_path`. + +You can download a file to `disk <#download-file-to-disk>`__ or to a `binary I/O <#download-file-to-binary-io-object>`__ object in the same way. + +Example: + +.. code-block:: + + document = message.document + await bot.download(document) diff --git a/docs2/source/api/index.rst b/docs2/source/api/index.rst new file mode 100644 index 00000000..90ae61a2 --- /dev/null +++ b/docs2/source/api/index.rst @@ -0,0 +1,15 @@ +####### +Bot API +####### + +**aiogram** now is fully support of `Telegram Bot API `_ + +All API methods and types is fully autogenerated from Telegram Bot API docs by parser with code-generator. + +.. toctree:: + bot + session/index + types/index + methods/index + download_file + upload_file diff --git a/docs2/source/api/methods/add_sticker_to_set.rst b/docs2/source/api/methods/add_sticker_to_set.rst new file mode 100644 index 00000000..0519f5ea --- /dev/null +++ b/docs2/source/api/methods/add_sticker_to_set.rst @@ -0,0 +1,52 @@ +############### +addStickerToSet +############### + +Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker or tgs_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.add_sticker_to_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.add_sticker_to_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AddStickerToSet` +- :code:`from aiogram.api.methods import AddStickerToSet` +- :code:`from aiogram.api.methods.add_sticker_to_set import AddStickerToSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AddStickerToSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AddStickerToSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AddStickerToSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/answer_callback_query.rst b/docs2/source/api/methods/answer_callback_query.rst new file mode 100644 index 00000000..4349a473 --- /dev/null +++ b/docs2/source/api/methods/answer_callback_query.rst @@ -0,0 +1,54 @@ +################### +answerCallbackQuery +################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_callback_query + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_callback_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerCallbackQuery` +- :code:`from aiogram.api.methods import AnswerCallbackQuery` +- :code:`from aiogram.api.methods.answer_callback_query import AnswerCallbackQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerCallbackQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerCallbackQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerCallbackQuery(...) \ No newline at end of file diff --git a/docs2/source/api/methods/answer_inline_query.rst b/docs2/source/api/methods/answer_inline_query.rst new file mode 100644 index 00000000..52490884 --- /dev/null +++ b/docs2/source/api/methods/answer_inline_query.rst @@ -0,0 +1,54 @@ +################# +answerInlineQuery +################# + +Use this method to send answers to an inline query. On success, True is returned. + +No more than 50 results per query are allowed. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_inline_query + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_inline_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerInlineQuery` +- :code:`from aiogram.api.methods import AnswerInlineQuery` +- :code:`from aiogram.api.methods.answer_inline_query import AnswerInlineQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerInlineQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerInlineQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerInlineQuery(...) \ No newline at end of file diff --git a/docs2/source/api/methods/answer_pre_checkout_query.rst b/docs2/source/api/methods/answer_pre_checkout_query.rst new file mode 100644 index 00000000..3ac039a4 --- /dev/null +++ b/docs2/source/api/methods/answer_pre_checkout_query.rst @@ -0,0 +1,52 @@ +###################### +answerPreCheckoutQuery +###################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_pre_checkout_query + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_pre_checkout_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerPreCheckoutQuery` +- :code:`from aiogram.api.methods import AnswerPreCheckoutQuery` +- :code:`from aiogram.api.methods.answer_pre_checkout_query import AnswerPreCheckoutQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerPreCheckoutQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerPreCheckoutQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerPreCheckoutQuery(...) \ No newline at end of file diff --git a/docs2/source/api/methods/answer_shipping_query.rst b/docs2/source/api/methods/answer_shipping_query.rst new file mode 100644 index 00000000..2753e0eb --- /dev/null +++ b/docs2/source/api/methods/answer_shipping_query.rst @@ -0,0 +1,52 @@ +################### +answerShippingQuery +################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_shipping_query + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_shipping_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerShippingQuery` +- :code:`from aiogram.api.methods import AnswerShippingQuery` +- :code:`from aiogram.api.methods.answer_shipping_query import AnswerShippingQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerShippingQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerShippingQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerShippingQuery(...) \ No newline at end of file diff --git a/docs2/source/api/methods/create_new_sticker_set.rst b/docs2/source/api/methods/create_new_sticker_set.rst new file mode 100644 index 00000000..8b272364 --- /dev/null +++ b/docs2/source/api/methods/create_new_sticker_set.rst @@ -0,0 +1,52 @@ +################### +createNewStickerSet +################### + +Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker or tgs_sticker. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.create_new_sticker_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.create_new_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import CreateNewStickerSet` +- :code:`from aiogram.api.methods import CreateNewStickerSet` +- :code:`from aiogram.api.methods.create_new_sticker_set import CreateNewStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await CreateNewStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(CreateNewStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return CreateNewStickerSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/delete_chat_photo.rst b/docs2/source/api/methods/delete_chat_photo.rst new file mode 100644 index 00000000..e71493e2 --- /dev/null +++ b/docs2/source/api/methods/delete_chat_photo.rst @@ -0,0 +1,52 @@ +############### +deleteChatPhoto +############### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_chat_photo + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_chat_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteChatPhoto` +- :code:`from aiogram.api.methods import DeleteChatPhoto` +- :code:`from aiogram.api.methods.delete_chat_photo import DeleteChatPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteChatPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteChatPhoto(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteChatPhoto(...) \ No newline at end of file diff --git a/docs2/source/api/methods/delete_chat_sticker_set.rst b/docs2/source/api/methods/delete_chat_sticker_set.rst new file mode 100644 index 00000000..a6cbef1f --- /dev/null +++ b/docs2/source/api/methods/delete_chat_sticker_set.rst @@ -0,0 +1,52 @@ +#################### +deleteChatStickerSet +#################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_chat_sticker_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_chat_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteChatStickerSet` +- :code:`from aiogram.api.methods import DeleteChatStickerSet` +- :code:`from aiogram.api.methods.delete_chat_sticker_set import DeleteChatStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteChatStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteChatStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteChatStickerSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/delete_message.rst b/docs2/source/api/methods/delete_message.rst new file mode 100644 index 00000000..e030fdb7 --- /dev/null +++ b/docs2/source/api/methods/delete_message.rst @@ -0,0 +1,68 @@ +############# +deleteMessage +############# + +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. + +- A dice message in a private chat can only be deleted if it was sent more than 24 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. + +Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_message + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteMessage` +- :code:`from aiogram.api.methods import DeleteMessage` +- :code:`from aiogram.api.methods.delete_message import DeleteMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteMessage(...) \ No newline at end of file diff --git a/docs2/source/api/methods/delete_sticker_from_set.rst b/docs2/source/api/methods/delete_sticker_from_set.rst new file mode 100644 index 00000000..aa4dbb84 --- /dev/null +++ b/docs2/source/api/methods/delete_sticker_from_set.rst @@ -0,0 +1,52 @@ +#################### +deleteStickerFromSet +#################### + +Use this method to delete a sticker from a set created by the bot. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_sticker_from_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_sticker_from_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteStickerFromSet` +- :code:`from aiogram.api.methods import DeleteStickerFromSet` +- :code:`from aiogram.api.methods.delete_sticker_from_set import DeleteStickerFromSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteStickerFromSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteStickerFromSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteStickerFromSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/delete_webhook.rst b/docs2/source/api/methods/delete_webhook.rst new file mode 100644 index 00000000..2344f5a2 --- /dev/null +++ b/docs2/source/api/methods/delete_webhook.rst @@ -0,0 +1,52 @@ +############# +deleteWebhook +############# + +Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_webhook + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_webhook(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteWebhook` +- :code:`from aiogram.api.methods import DeleteWebhook` +- :code:`from aiogram.api.methods.delete_webhook import DeleteWebhook` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteWebhook(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteWebhook(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteWebhook(...) \ No newline at end of file diff --git a/docs2/source/api/methods/edit_message_caption.rst b/docs2/source/api/methods/edit_message_caption.rst new file mode 100644 index 00000000..82c47c77 --- /dev/null +++ b/docs2/source/api/methods/edit_message_caption.rst @@ -0,0 +1,52 @@ +################## +editMessageCaption +################## + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_caption + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_caption(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageCaption` +- :code:`from aiogram.api.methods import EditMessageCaption` +- :code:`from aiogram.api.methods.edit_message_caption import EditMessageCaption` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageCaption(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageCaption(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageCaption(...) \ No newline at end of file diff --git a/docs2/source/api/methods/edit_message_live_location.rst b/docs2/source/api/methods/edit_message_live_location.rst new file mode 100644 index 00000000..e969b735 --- /dev/null +++ b/docs2/source/api/methods/edit_message_live_location.rst @@ -0,0 +1,52 @@ +####################### +editMessageLiveLocation +####################### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_live_location + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_live_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageLiveLocation` +- :code:`from aiogram.api.methods import EditMessageLiveLocation` +- :code:`from aiogram.api.methods.edit_message_live_location import EditMessageLiveLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageLiveLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageLiveLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageLiveLocation(...) \ No newline at end of file diff --git a/docs2/source/api/methods/edit_message_media.rst b/docs2/source/api/methods/edit_message_media.rst new file mode 100644 index 00000000..e6b4a1f4 --- /dev/null +++ b/docs2/source/api/methods/edit_message_media.rst @@ -0,0 +1,52 @@ +################ +editMessageMedia +################ + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_media + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_media(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageMedia` +- :code:`from aiogram.api.methods import EditMessageMedia` +- :code:`from aiogram.api.methods.edit_message_media import EditMessageMedia` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageMedia(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageMedia(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageMedia(...) \ No newline at end of file diff --git a/docs2/source/api/methods/edit_message_reply_markup.rst b/docs2/source/api/methods/edit_message_reply_markup.rst new file mode 100644 index 00000000..22527d69 --- /dev/null +++ b/docs2/source/api/methods/edit_message_reply_markup.rst @@ -0,0 +1,52 @@ +###################### +editMessageReplyMarkup +###################### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_reply_markup + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_reply_markup(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageReplyMarkup` +- :code:`from aiogram.api.methods import EditMessageReplyMarkup` +- :code:`from aiogram.api.methods.edit_message_reply_markup import EditMessageReplyMarkup` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageReplyMarkup(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageReplyMarkup(...) \ No newline at end of file diff --git a/docs2/source/api/methods/edit_message_text.rst b/docs2/source/api/methods/edit_message_text.rst new file mode 100644 index 00000000..74230ee2 --- /dev/null +++ b/docs2/source/api/methods/edit_message_text.rst @@ -0,0 +1,52 @@ +############### +editMessageText +############### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_text + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_text(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageText` +- :code:`from aiogram.api.methods import EditMessageText` +- :code:`from aiogram.api.methods.edit_message_text import EditMessageText` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageText(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageText(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageText(...) \ No newline at end of file diff --git a/docs2/source/api/methods/export_chat_invite_link.rst b/docs2/source/api/methods/export_chat_invite_link.rst new file mode 100644 index 00000000..089b7d8f --- /dev/null +++ b/docs2/source/api/methods/export_chat_invite_link.rst @@ -0,0 +1,54 @@ +#################### +exportChatInviteLink +#################### + +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. + +Returns: :obj:`str` + +.. automodule:: aiogram.api.methods.export_chat_invite_link + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: str = await bot.export_chat_invite_link(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import ExportChatInviteLink` +- :code:`from aiogram.api.methods import ExportChatInviteLink` +- :code:`from aiogram.api.methods.export_chat_invite_link import ExportChatInviteLink` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: str = await ExportChatInviteLink(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: str = await bot(ExportChatInviteLink(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return ExportChatInviteLink(...) \ No newline at end of file diff --git a/docs2/source/api/methods/forward_message.rst b/docs2/source/api/methods/forward_message.rst new file mode 100644 index 00000000..285d0f4d --- /dev/null +++ b/docs2/source/api/methods/forward_message.rst @@ -0,0 +1,52 @@ +############## +forwardMessage +############## + +Use this method to forward messages of any kind. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.forward_message + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.forward_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import ForwardMessage` +- :code:`from aiogram.api.methods import ForwardMessage` +- :code:`from aiogram.api.methods.forward_message import ForwardMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await ForwardMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(ForwardMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return ForwardMessage(...) \ No newline at end of file diff --git a/docs2/source/api/methods/get_chat.rst b/docs2/source/api/methods/get_chat.rst new file mode 100644 index 00000000..02e115ee --- /dev/null +++ b/docs2/source/api/methods/get_chat.rst @@ -0,0 +1,46 @@ +####### +getChat +####### + +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. + +Returns: :obj:`Chat` + +.. automodule:: aiogram.api.methods.get_chat + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Chat = await bot.get_chat(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChat` +- :code:`from aiogram.api.methods import GetChat` +- :code:`from aiogram.api.methods.get_chat import GetChat` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Chat = await GetChat(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Chat = await bot(GetChat(...)) + diff --git a/docs2/source/api/methods/get_chat_administrators.rst b/docs2/source/api/methods/get_chat_administrators.rst new file mode 100644 index 00000000..01da98e8 --- /dev/null +++ b/docs2/source/api/methods/get_chat_administrators.rst @@ -0,0 +1,46 @@ +##################### +getChatAdministrators +##################### + +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. + +Returns: :obj:`List[ChatMember]` + +.. automodule:: aiogram.api.methods.get_chat_administrators + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[ChatMember] = await bot.get_chat_administrators(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatAdministrators` +- :code:`from aiogram.api.methods import GetChatAdministrators` +- :code:`from aiogram.api.methods.get_chat_administrators import GetChatAdministrators` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[ChatMember] = await GetChatAdministrators(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[ChatMember] = await bot(GetChatAdministrators(...)) + diff --git a/docs2/source/api/methods/get_chat_member.rst b/docs2/source/api/methods/get_chat_member.rst new file mode 100644 index 00000000..07f8025b --- /dev/null +++ b/docs2/source/api/methods/get_chat_member.rst @@ -0,0 +1,46 @@ +############# +getChatMember +############# + +Use this method to get information about a member of a chat. Returns a ChatMember object on success. + +Returns: :obj:`ChatMember` + +.. automodule:: aiogram.api.methods.get_chat_member + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: ChatMember = await bot.get_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatMember` +- :code:`from aiogram.api.methods import GetChatMember` +- :code:`from aiogram.api.methods.get_chat_member import GetChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: ChatMember = await GetChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: ChatMember = await bot(GetChatMember(...)) + diff --git a/docs2/source/api/methods/get_chat_members_count.rst b/docs2/source/api/methods/get_chat_members_count.rst new file mode 100644 index 00000000..84c50d75 --- /dev/null +++ b/docs2/source/api/methods/get_chat_members_count.rst @@ -0,0 +1,46 @@ +################### +getChatMembersCount +################### + +Use this method to get the number of members in a chat. Returns Int on success. + +Returns: :obj:`int` + +.. automodule:: aiogram.api.methods.get_chat_members_count + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: int = await bot.get_chat_members_count(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatMembersCount` +- :code:`from aiogram.api.methods import GetChatMembersCount` +- :code:`from aiogram.api.methods.get_chat_members_count import GetChatMembersCount` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: int = await GetChatMembersCount(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: int = await bot(GetChatMembersCount(...)) + diff --git a/docs2/source/api/methods/get_file.rst b/docs2/source/api/methods/get_file.rst new file mode 100644 index 00000000..a3ba84b4 --- /dev/null +++ b/docs2/source/api/methods/get_file.rst @@ -0,0 +1,48 @@ +####### +getFile +####### + +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. + +Returns: :obj:`File` + +.. automodule:: aiogram.api.methods.get_file + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: File = await bot.get_file(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetFile` +- :code:`from aiogram.api.methods import GetFile` +- :code:`from aiogram.api.methods.get_file import GetFile` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: File = await GetFile(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: File = await bot(GetFile(...)) + diff --git a/docs2/source/api/methods/get_game_high_scores.rst b/docs2/source/api/methods/get_game_high_scores.rst new file mode 100644 index 00000000..9326171e --- /dev/null +++ b/docs2/source/api/methods/get_game_high_scores.rst @@ -0,0 +1,48 @@ +################# +getGameHighScores +################# + +Use this method to get data for high score tables. Will return the score of the specified user and several of their 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 their 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. + +Returns: :obj:`List[GameHighScore]` + +.. automodule:: aiogram.api.methods.get_game_high_scores + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[GameHighScore] = await bot.get_game_high_scores(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetGameHighScores` +- :code:`from aiogram.api.methods import GetGameHighScores` +- :code:`from aiogram.api.methods.get_game_high_scores import GetGameHighScores` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[GameHighScore] = await GetGameHighScores(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[GameHighScore] = await bot(GetGameHighScores(...)) + diff --git a/docs2/source/api/methods/get_me.rst b/docs2/source/api/methods/get_me.rst new file mode 100644 index 00000000..a43f35cf --- /dev/null +++ b/docs2/source/api/methods/get_me.rst @@ -0,0 +1,46 @@ +##### +getMe +##### + +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. + +Returns: :obj:`User` + +.. automodule:: aiogram.api.methods.get_me + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: User = await bot.get_me(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetMe` +- :code:`from aiogram.api.methods import GetMe` +- :code:`from aiogram.api.methods.get_me import GetMe` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: User = await GetMe(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: User = await bot(GetMe(...)) + diff --git a/docs2/source/api/methods/get_my_commands.rst b/docs2/source/api/methods/get_my_commands.rst new file mode 100644 index 00000000..a228938d --- /dev/null +++ b/docs2/source/api/methods/get_my_commands.rst @@ -0,0 +1,46 @@ +############# +getMyCommands +############# + +Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of BotCommand on success. + +Returns: :obj:`List[BotCommand]` + +.. automodule:: aiogram.api.methods.get_my_commands + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[BotCommand] = await bot.get_my_commands(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetMyCommands` +- :code:`from aiogram.api.methods import GetMyCommands` +- :code:`from aiogram.api.methods.get_my_commands import GetMyCommands` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[BotCommand] = await GetMyCommands(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[BotCommand] = await bot(GetMyCommands(...)) + diff --git a/docs2/source/api/methods/get_sticker_set.rst b/docs2/source/api/methods/get_sticker_set.rst new file mode 100644 index 00000000..66d1c768 --- /dev/null +++ b/docs2/source/api/methods/get_sticker_set.rst @@ -0,0 +1,46 @@ +############# +getStickerSet +############# + +Use this method to get a sticker set. On success, a StickerSet object is returned. + +Returns: :obj:`StickerSet` + +.. automodule:: aiogram.api.methods.get_sticker_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: StickerSet = await bot.get_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetStickerSet` +- :code:`from aiogram.api.methods import GetStickerSet` +- :code:`from aiogram.api.methods.get_sticker_set import GetStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: StickerSet = await GetStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: StickerSet = await bot(GetStickerSet(...)) + diff --git a/docs2/source/api/methods/get_updates.rst b/docs2/source/api/methods/get_updates.rst new file mode 100644 index 00000000..7204145d --- /dev/null +++ b/docs2/source/api/methods/get_updates.rst @@ -0,0 +1,52 @@ +########## +getUpdates +########## + +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. + +Returns: :obj:`List[Update]` + +.. automodule:: aiogram.api.methods.get_updates + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[Update] = await bot.get_updates(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetUpdates` +- :code:`from aiogram.api.methods import GetUpdates` +- :code:`from aiogram.api.methods.get_updates import GetUpdates` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[Update] = await GetUpdates(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[Update] = await bot(GetUpdates(...)) + diff --git a/docs2/source/api/methods/get_user_profile_photos.rst b/docs2/source/api/methods/get_user_profile_photos.rst new file mode 100644 index 00000000..2f42d65f --- /dev/null +++ b/docs2/source/api/methods/get_user_profile_photos.rst @@ -0,0 +1,46 @@ +#################### +getUserProfilePhotos +#################### + +Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. + +Returns: :obj:`UserProfilePhotos` + +.. automodule:: aiogram.api.methods.get_user_profile_photos + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: UserProfilePhotos = await bot.get_user_profile_photos(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetUserProfilePhotos` +- :code:`from aiogram.api.methods import GetUserProfilePhotos` +- :code:`from aiogram.api.methods.get_user_profile_photos import GetUserProfilePhotos` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: UserProfilePhotos = await GetUserProfilePhotos(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: UserProfilePhotos = await bot(GetUserProfilePhotos(...)) + diff --git a/docs2/source/api/methods/get_webhook_info.rst b/docs2/source/api/methods/get_webhook_info.rst new file mode 100644 index 00000000..0534ff50 --- /dev/null +++ b/docs2/source/api/methods/get_webhook_info.rst @@ -0,0 +1,46 @@ +############## +getWebhookInfo +############## + +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. + +Returns: :obj:`WebhookInfo` + +.. automodule:: aiogram.api.methods.get_webhook_info + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: WebhookInfo = await bot.get_webhook_info(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetWebhookInfo` +- :code:`from aiogram.api.methods import GetWebhookInfo` +- :code:`from aiogram.api.methods.get_webhook_info import GetWebhookInfo` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: WebhookInfo = await GetWebhookInfo(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: WebhookInfo = await bot(GetWebhookInfo(...)) + diff --git a/docs2/source/api/methods/index.rst b/docs2/source/api/methods/index.rst new file mode 100644 index 00000000..5d4f0f70 --- /dev/null +++ b/docs2/source/api/methods/index.rst @@ -0,0 +1,138 @@ +####### +Methods +####### + +All API methods is wrapped as `pydantic `_ models +and placed in :mod:`aiogram.api.methods` package so that's mean all values which you pass +as arguments to the methods will be validated. + +Here is all methods is classes and in due to Python standards all classes named in +upper camel case, for example methods :code:`sendMessage` has the name :code:`SendMessage` + + +Getting updates +=============== + +.. toctree:: + :maxdepth: 1 + + get_updates + set_webhook + delete_webhook + get_webhook_info + + +Available methods +================= + +.. toctree:: + :maxdepth: 1 + + get_me + send_message + forward_message + send_photo + send_audio + send_document + send_video + send_animation + send_voice + send_video_note + send_media_group + send_location + edit_message_live_location + stop_message_live_location + send_venue + send_contact + send_poll + send_dice + send_chat_action + get_user_profile_photos + get_file + kick_chat_member + unban_chat_member + restrict_chat_member + promote_chat_member + set_chat_administrator_custom_title + set_chat_permissions + export_chat_invite_link + set_chat_photo + delete_chat_photo + set_chat_title + set_chat_description + pin_chat_message + unpin_chat_message + leave_chat + get_chat + get_chat_administrators + get_chat_members_count + get_chat_member + set_chat_sticker_set + delete_chat_sticker_set + answer_callback_query + set_my_commands + get_my_commands + +Updating messages +================= + +.. toctree:: + :maxdepth: 1 + + edit_message_text + edit_message_caption + edit_message_media + edit_message_reply_markup + stop_poll + delete_message + +Stickers +======== + +.. toctree:: + :maxdepth: 1 + + send_sticker + get_sticker_set + upload_sticker_file + create_new_sticker_set + add_sticker_to_set + set_sticker_position_in_set + delete_sticker_from_set + set_sticker_set_thumb + +Inline mode +=========== + +.. toctree:: + :maxdepth: 1 + + answer_inline_query + +Payments +======== + +.. toctree:: + :maxdepth: 1 + + send_invoice + answer_shipping_query + answer_pre_checkout_query + +Telegram Passport +================= + +.. toctree:: + :maxdepth: 1 + + set_passport_data_errors + +Games +===== + +.. toctree:: + :maxdepth: 1 + + send_game + set_game_score + get_game_high_scores diff --git a/docs2/source/api/methods/kick_chat_member.rst b/docs2/source/api/methods/kick_chat_member.rst new file mode 100644 index 00000000..0a3247b9 --- /dev/null +++ b/docs2/source/api/methods/kick_chat_member.rst @@ -0,0 +1,52 @@ +############## +kickChatMember +############## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.kick_chat_member + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.kick_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import KickChatMember` +- :code:`from aiogram.api.methods import KickChatMember` +- :code:`from aiogram.api.methods.kick_chat_member import KickChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await KickChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(KickChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return KickChatMember(...) \ No newline at end of file diff --git a/docs2/source/api/methods/leave_chat.rst b/docs2/source/api/methods/leave_chat.rst new file mode 100644 index 00000000..13c802a0 --- /dev/null +++ b/docs2/source/api/methods/leave_chat.rst @@ -0,0 +1,52 @@ +######### +leaveChat +######### + +Use this method for your bot to leave a group, supergroup or channel. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.leave_chat + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.leave_chat(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import LeaveChat` +- :code:`from aiogram.api.methods import LeaveChat` +- :code:`from aiogram.api.methods.leave_chat import LeaveChat` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await LeaveChat(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(LeaveChat(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return LeaveChat(...) \ No newline at end of file diff --git a/docs2/source/api/methods/pin_chat_message.rst b/docs2/source/api/methods/pin_chat_message.rst new file mode 100644 index 00000000..189e4d8f --- /dev/null +++ b/docs2/source/api/methods/pin_chat_message.rst @@ -0,0 +1,52 @@ +############## +pinChatMessage +############## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.pin_chat_message + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.pin_chat_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import PinChatMessage` +- :code:`from aiogram.api.methods import PinChatMessage` +- :code:`from aiogram.api.methods.pin_chat_message import PinChatMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await PinChatMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(PinChatMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return PinChatMessage(...) \ No newline at end of file diff --git a/docs2/source/api/methods/promote_chat_member.rst b/docs2/source/api/methods/promote_chat_member.rst new file mode 100644 index 00000000..3d039656 --- /dev/null +++ b/docs2/source/api/methods/promote_chat_member.rst @@ -0,0 +1,52 @@ +################# +promoteChatMember +################# + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.promote_chat_member + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.promote_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import PromoteChatMember` +- :code:`from aiogram.api.methods import PromoteChatMember` +- :code:`from aiogram.api.methods.promote_chat_member import PromoteChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await PromoteChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(PromoteChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return PromoteChatMember(...) \ No newline at end of file diff --git a/docs2/source/api/methods/restrict_chat_member.rst b/docs2/source/api/methods/restrict_chat_member.rst new file mode 100644 index 00000000..6210a1a6 --- /dev/null +++ b/docs2/source/api/methods/restrict_chat_member.rst @@ -0,0 +1,52 @@ +################## +restrictChatMember +################## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.restrict_chat_member + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.restrict_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import RestrictChatMember` +- :code:`from aiogram.api.methods import RestrictChatMember` +- :code:`from aiogram.api.methods.restrict_chat_member import RestrictChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await RestrictChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(RestrictChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return RestrictChatMember(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_animation.rst b/docs2/source/api/methods/send_animation.rst new file mode 100644 index 00000000..471d518d --- /dev/null +++ b/docs2/source/api/methods/send_animation.rst @@ -0,0 +1,52 @@ +############# +sendAnimation +############# + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_animation + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_animation(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendAnimation` +- :code:`from aiogram.api.methods import SendAnimation` +- :code:`from aiogram.api.methods.send_animation import SendAnimation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendAnimation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendAnimation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendAnimation(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_audio.rst b/docs2/source/api/methods/send_audio.rst new file mode 100644 index 00000000..d80df3f3 --- /dev/null +++ b/docs2/source/api/methods/send_audio.rst @@ -0,0 +1,54 @@ +######### +sendAudio +######### + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_audio + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_audio(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendAudio` +- :code:`from aiogram.api.methods import SendAudio` +- :code:`from aiogram.api.methods.send_audio import SendAudio` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendAudio(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendAudio(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendAudio(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_chat_action.rst b/docs2/source/api/methods/send_chat_action.rst new file mode 100644 index 00000000..5a0b4516 --- /dev/null +++ b/docs2/source/api/methods/send_chat_action.rst @@ -0,0 +1,56 @@ +############## +sendChatAction +############## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.send_chat_action + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.send_chat_action(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendChatAction` +- :code:`from aiogram.api.methods import SendChatAction` +- :code:`from aiogram.api.methods.send_chat_action import SendChatAction` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SendChatAction(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SendChatAction(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendChatAction(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_contact.rst b/docs2/source/api/methods/send_contact.rst new file mode 100644 index 00000000..7bce0f54 --- /dev/null +++ b/docs2/source/api/methods/send_contact.rst @@ -0,0 +1,52 @@ +########### +sendContact +########### + +Use this method to send phone contacts. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_contact + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_contact(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendContact` +- :code:`from aiogram.api.methods import SendContact` +- :code:`from aiogram.api.methods.send_contact import SendContact` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendContact(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendContact(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendContact(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_dice.rst b/docs2/source/api/methods/send_dice.rst new file mode 100644 index 00000000..2226db47 --- /dev/null +++ b/docs2/source/api/methods/send_dice.rst @@ -0,0 +1,52 @@ +######## +sendDice +######## + +Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_dice + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_dice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendDice` +- :code:`from aiogram.api.methods import SendDice` +- :code:`from aiogram.api.methods.send_dice import SendDice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendDice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendDice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendDice(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_document.rst b/docs2/source/api/methods/send_document.rst new file mode 100644 index 00000000..9ceeffdc --- /dev/null +++ b/docs2/source/api/methods/send_document.rst @@ -0,0 +1,52 @@ +############ +sendDocument +############ + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_document + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_document(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendDocument` +- :code:`from aiogram.api.methods import SendDocument` +- :code:`from aiogram.api.methods.send_document import SendDocument` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendDocument(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendDocument(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendDocument(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_game.rst b/docs2/source/api/methods/send_game.rst new file mode 100644 index 00000000..73ca2a6a --- /dev/null +++ b/docs2/source/api/methods/send_game.rst @@ -0,0 +1,52 @@ +######## +sendGame +######## + +Use this method to send a game. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_game + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_game(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendGame` +- :code:`from aiogram.api.methods import SendGame` +- :code:`from aiogram.api.methods.send_game import SendGame` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendGame(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendGame(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendGame(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_invoice.rst b/docs2/source/api/methods/send_invoice.rst new file mode 100644 index 00000000..41d94cbd --- /dev/null +++ b/docs2/source/api/methods/send_invoice.rst @@ -0,0 +1,52 @@ +########### +sendInvoice +########### + +Use this method to send invoices. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_invoice + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_invoice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendInvoice` +- :code:`from aiogram.api.methods import SendInvoice` +- :code:`from aiogram.api.methods.send_invoice import SendInvoice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendInvoice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendInvoice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendInvoice(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_location.rst b/docs2/source/api/methods/send_location.rst new file mode 100644 index 00000000..d7ecbd2d --- /dev/null +++ b/docs2/source/api/methods/send_location.rst @@ -0,0 +1,52 @@ +############ +sendLocation +############ + +Use this method to send point on the map. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_location + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendLocation` +- :code:`from aiogram.api.methods import SendLocation` +- :code:`from aiogram.api.methods.send_location import SendLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendLocation(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_media_group.rst b/docs2/source/api/methods/send_media_group.rst new file mode 100644 index 00000000..d7557e51 --- /dev/null +++ b/docs2/source/api/methods/send_media_group.rst @@ -0,0 +1,52 @@ +############## +sendMediaGroup +############## + +Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. + +Returns: :obj:`List[Message]` + +.. automodule:: aiogram.api.methods.send_media_group + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[Message] = await bot.send_media_group(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendMediaGroup` +- :code:`from aiogram.api.methods import SendMediaGroup` +- :code:`from aiogram.api.methods.send_media_group import SendMediaGroup` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[Message] = await SendMediaGroup(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[Message] = await bot(SendMediaGroup(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendMediaGroup(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_message.rst b/docs2/source/api/methods/send_message.rst new file mode 100644 index 00000000..263bc612 --- /dev/null +++ b/docs2/source/api/methods/send_message.rst @@ -0,0 +1,52 @@ +########### +sendMessage +########### + +Use this method to send text messages. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_message + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendMessage` +- :code:`from aiogram.api.methods import SendMessage` +- :code:`from aiogram.api.methods.send_message import SendMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendMessage(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_photo.rst b/docs2/source/api/methods/send_photo.rst new file mode 100644 index 00000000..5ecee825 --- /dev/null +++ b/docs2/source/api/methods/send_photo.rst @@ -0,0 +1,52 @@ +######### +sendPhoto +######### + +Use this method to send photos. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_photo + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendPhoto` +- :code:`from aiogram.api.methods import SendPhoto` +- :code:`from aiogram.api.methods.send_photo import SendPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendPhoto(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendPhoto(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_poll.rst b/docs2/source/api/methods/send_poll.rst new file mode 100644 index 00000000..18812c64 --- /dev/null +++ b/docs2/source/api/methods/send_poll.rst @@ -0,0 +1,52 @@ +######## +sendPoll +######## + +Use this method to send a native poll. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_poll + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_poll(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendPoll` +- :code:`from aiogram.api.methods import SendPoll` +- :code:`from aiogram.api.methods.send_poll import SendPoll` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendPoll(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendPoll(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendPoll(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_sticker.rst b/docs2/source/api/methods/send_sticker.rst new file mode 100644 index 00000000..686b6ebd --- /dev/null +++ b/docs2/source/api/methods/send_sticker.rst @@ -0,0 +1,52 @@ +########### +sendSticker +########### + +Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_sticker + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_sticker(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendSticker` +- :code:`from aiogram.api.methods import SendSticker` +- :code:`from aiogram.api.methods.send_sticker import SendSticker` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendSticker(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendSticker(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendSticker(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_venue.rst b/docs2/source/api/methods/send_venue.rst new file mode 100644 index 00000000..32ff21b5 --- /dev/null +++ b/docs2/source/api/methods/send_venue.rst @@ -0,0 +1,52 @@ +######### +sendVenue +######### + +Use this method to send information about a venue. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_venue + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_venue(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVenue` +- :code:`from aiogram.api.methods import SendVenue` +- :code:`from aiogram.api.methods.send_venue import SendVenue` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVenue(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVenue(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVenue(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_video.rst b/docs2/source/api/methods/send_video.rst new file mode 100644 index 00000000..22695f7f --- /dev/null +++ b/docs2/source/api/methods/send_video.rst @@ -0,0 +1,52 @@ +######### +sendVideo +######### + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_video + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_video(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVideo` +- :code:`from aiogram.api.methods import SendVideo` +- :code:`from aiogram.api.methods.send_video import SendVideo` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVideo(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVideo(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVideo(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_video_note.rst b/docs2/source/api/methods/send_video_note.rst new file mode 100644 index 00000000..71c2f777 --- /dev/null +++ b/docs2/source/api/methods/send_video_note.rst @@ -0,0 +1,52 @@ +############# +sendVideoNote +############# + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_video_note + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_video_note(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVideoNote` +- :code:`from aiogram.api.methods import SendVideoNote` +- :code:`from aiogram.api.methods.send_video_note import SendVideoNote` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVideoNote(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVideoNote(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVideoNote(...) \ No newline at end of file diff --git a/docs2/source/api/methods/send_voice.rst b/docs2/source/api/methods/send_voice.rst new file mode 100644 index 00000000..82b25060 --- /dev/null +++ b/docs2/source/api/methods/send_voice.rst @@ -0,0 +1,52 @@ +######### +sendVoice +######### + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_voice + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_voice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVoice` +- :code:`from aiogram.api.methods import SendVoice` +- :code:`from aiogram.api.methods.send_voice import SendVoice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVoice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVoice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVoice(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_chat_administrator_custom_title.rst b/docs2/source/api/methods/set_chat_administrator_custom_title.rst new file mode 100644 index 00000000..2997557b --- /dev/null +++ b/docs2/source/api/methods/set_chat_administrator_custom_title.rst @@ -0,0 +1,52 @@ +############################### +setChatAdministratorCustomTitle +############################### + +Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_administrator_custom_title + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_administrator_custom_title(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatAdministratorCustomTitle` +- :code:`from aiogram.api.methods import SetChatAdministratorCustomTitle` +- :code:`from aiogram.api.methods.set_chat_administrator_custom_title import SetChatAdministratorCustomTitle` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatAdministratorCustomTitle(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatAdministratorCustomTitle(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatAdministratorCustomTitle(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_chat_description.rst b/docs2/source/api/methods/set_chat_description.rst new file mode 100644 index 00000000..faa8cb91 --- /dev/null +++ b/docs2/source/api/methods/set_chat_description.rst @@ -0,0 +1,52 @@ +################## +setChatDescription +################## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_description + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_description(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatDescription` +- :code:`from aiogram.api.methods import SetChatDescription` +- :code:`from aiogram.api.methods.set_chat_description import SetChatDescription` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatDescription(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatDescription(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatDescription(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_chat_permissions.rst b/docs2/source/api/methods/set_chat_permissions.rst new file mode 100644 index 00000000..0b6c6030 --- /dev/null +++ b/docs2/source/api/methods/set_chat_permissions.rst @@ -0,0 +1,52 @@ +################## +setChatPermissions +################## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_permissions + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_permissions(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatPermissions` +- :code:`from aiogram.api.methods import SetChatPermissions` +- :code:`from aiogram.api.methods.set_chat_permissions import SetChatPermissions` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatPermissions(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatPermissions(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatPermissions(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_chat_photo.rst b/docs2/source/api/methods/set_chat_photo.rst new file mode 100644 index 00000000..2f9a4f89 --- /dev/null +++ b/docs2/source/api/methods/set_chat_photo.rst @@ -0,0 +1,46 @@ +############ +setChatPhoto +############ + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_photo + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatPhoto` +- :code:`from aiogram.api.methods import SetChatPhoto` +- :code:`from aiogram.api.methods.set_chat_photo import SetChatPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatPhoto(...)) + diff --git a/docs2/source/api/methods/set_chat_sticker_set.rst b/docs2/source/api/methods/set_chat_sticker_set.rst new file mode 100644 index 00000000..ed52e70f --- /dev/null +++ b/docs2/source/api/methods/set_chat_sticker_set.rst @@ -0,0 +1,52 @@ +################# +setChatStickerSet +################# + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_sticker_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatStickerSet` +- :code:`from aiogram.api.methods import SetChatStickerSet` +- :code:`from aiogram.api.methods.set_chat_sticker_set import SetChatStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatStickerSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_chat_title.rst b/docs2/source/api/methods/set_chat_title.rst new file mode 100644 index 00000000..d4643377 --- /dev/null +++ b/docs2/source/api/methods/set_chat_title.rst @@ -0,0 +1,52 @@ +############ +setChatTitle +############ + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_title + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_title(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatTitle` +- :code:`from aiogram.api.methods import SetChatTitle` +- :code:`from aiogram.api.methods.set_chat_title import SetChatTitle` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatTitle(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatTitle(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatTitle(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_game_score.rst b/docs2/source/api/methods/set_game_score.rst new file mode 100644 index 00000000..a64062ad --- /dev/null +++ b/docs2/source/api/methods/set_game_score.rst @@ -0,0 +1,52 @@ +############ +setGameScore +############ + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.set_game_score + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.set_game_score(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetGameScore` +- :code:`from aiogram.api.methods import SetGameScore` +- :code:`from aiogram.api.methods.set_game_score import SetGameScore` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await SetGameScore(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(SetGameScore(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetGameScore(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_my_commands.rst b/docs2/source/api/methods/set_my_commands.rst new file mode 100644 index 00000000..49e8e8cd --- /dev/null +++ b/docs2/source/api/methods/set_my_commands.rst @@ -0,0 +1,52 @@ +############# +setMyCommands +############# + +Use this method to change the list of the bot's commands. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_my_commands + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_my_commands(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetMyCommands` +- :code:`from aiogram.api.methods import SetMyCommands` +- :code:`from aiogram.api.methods.set_my_commands import SetMyCommands` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetMyCommands(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetMyCommands(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetMyCommands(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_passport_data_errors.rst b/docs2/source/api/methods/set_passport_data_errors.rst new file mode 100644 index 00000000..b34271c7 --- /dev/null +++ b/docs2/source/api/methods/set_passport_data_errors.rst @@ -0,0 +1,54 @@ +##################### +setPassportDataErrors +##################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_passport_data_errors + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_passport_data_errors(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetPassportDataErrors` +- :code:`from aiogram.api.methods import SetPassportDataErrors` +- :code:`from aiogram.api.methods.set_passport_data_errors import SetPassportDataErrors` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetPassportDataErrors(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetPassportDataErrors(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetPassportDataErrors(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_sticker_position_in_set.rst b/docs2/source/api/methods/set_sticker_position_in_set.rst new file mode 100644 index 00000000..b5adf59d --- /dev/null +++ b/docs2/source/api/methods/set_sticker_position_in_set.rst @@ -0,0 +1,52 @@ +####################### +setStickerPositionInSet +####################### + +Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_sticker_position_in_set + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_sticker_position_in_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetStickerPositionInSet` +- :code:`from aiogram.api.methods import SetStickerPositionInSet` +- :code:`from aiogram.api.methods.set_sticker_position_in_set import SetStickerPositionInSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetStickerPositionInSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetStickerPositionInSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetStickerPositionInSet(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_sticker_set_thumb.rst b/docs2/source/api/methods/set_sticker_set_thumb.rst new file mode 100644 index 00000000..5dce98a8 --- /dev/null +++ b/docs2/source/api/methods/set_sticker_set_thumb.rst @@ -0,0 +1,52 @@ +################## +setStickerSetThumb +################## + +Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_sticker_set_thumb + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_sticker_set_thumb(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetStickerSetThumb` +- :code:`from aiogram.api.methods import SetStickerSetThumb` +- :code:`from aiogram.api.methods.set_sticker_set_thumb import SetStickerSetThumb` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetStickerSetThumb(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetStickerSetThumb(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetStickerSetThumb(...) \ No newline at end of file diff --git a/docs2/source/api/methods/set_webhook.rst b/docs2/source/api/methods/set_webhook.rst new file mode 100644 index 00000000..9c05bbaf --- /dev/null +++ b/docs2/source/api/methods/set_webhook.rst @@ -0,0 +1,64 @@ +########## +setWebhook +########## + +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. + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_webhook + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_webhook(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetWebhook` +- :code:`from aiogram.api.methods import SetWebhook` +- :code:`from aiogram.api.methods.set_webhook import SetWebhook` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetWebhook(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetWebhook(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetWebhook(...) \ No newline at end of file diff --git a/docs2/source/api/methods/stop_message_live_location.rst b/docs2/source/api/methods/stop_message_live_location.rst new file mode 100644 index 00000000..59646613 --- /dev/null +++ b/docs2/source/api/methods/stop_message_live_location.rst @@ -0,0 +1,52 @@ +####################### +stopMessageLiveLocation +####################### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.stop_message_live_location + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.stop_message_live_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import StopMessageLiveLocation` +- :code:`from aiogram.api.methods import StopMessageLiveLocation` +- :code:`from aiogram.api.methods.stop_message_live_location import StopMessageLiveLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await StopMessageLiveLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(StopMessageLiveLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return StopMessageLiveLocation(...) \ No newline at end of file diff --git a/docs2/source/api/methods/stop_poll.rst b/docs2/source/api/methods/stop_poll.rst new file mode 100644 index 00000000..6fa81cdc --- /dev/null +++ b/docs2/source/api/methods/stop_poll.rst @@ -0,0 +1,52 @@ +######## +stopPoll +######## + +Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. + +Returns: :obj:`Poll` + +.. automodule:: aiogram.api.methods.stop_poll + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Poll = await bot.stop_poll(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import StopPoll` +- :code:`from aiogram.api.methods import StopPoll` +- :code:`from aiogram.api.methods.stop_poll import StopPoll` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Poll = await StopPoll(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Poll = await bot(StopPoll(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return StopPoll(...) \ No newline at end of file diff --git a/docs2/source/api/methods/unban_chat_member.rst b/docs2/source/api/methods/unban_chat_member.rst new file mode 100644 index 00000000..8a4c78c9 --- /dev/null +++ b/docs2/source/api/methods/unban_chat_member.rst @@ -0,0 +1,52 @@ +############### +unbanChatMember +############### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.unban_chat_member + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.unban_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UnbanChatMember` +- :code:`from aiogram.api.methods import UnbanChatMember` +- :code:`from aiogram.api.methods.unban_chat_member import UnbanChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await UnbanChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(UnbanChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return UnbanChatMember(...) \ No newline at end of file diff --git a/docs2/source/api/methods/unpin_chat_message.rst b/docs2/source/api/methods/unpin_chat_message.rst new file mode 100644 index 00000000..cb2d82c4 --- /dev/null +++ b/docs2/source/api/methods/unpin_chat_message.rst @@ -0,0 +1,52 @@ +################ +unpinChatMessage +################ + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.unpin_chat_message + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.unpin_chat_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UnpinChatMessage` +- :code:`from aiogram.api.methods import UnpinChatMessage` +- :code:`from aiogram.api.methods.unpin_chat_message import UnpinChatMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await UnpinChatMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(UnpinChatMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return UnpinChatMessage(...) \ No newline at end of file diff --git a/docs2/source/api/methods/upload_sticker_file.rst b/docs2/source/api/methods/upload_sticker_file.rst new file mode 100644 index 00000000..158c8c52 --- /dev/null +++ b/docs2/source/api/methods/upload_sticker_file.rst @@ -0,0 +1,46 @@ +################# +uploadStickerFile +################# + +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. + +Returns: :obj:`File` + +.. automodule:: aiogram.api.methods.upload_sticker_file + :members: + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: File = await bot.upload_sticker_file(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UploadStickerFile` +- :code:`from aiogram.api.methods import UploadStickerFile` +- :code:`from aiogram.api.methods.upload_sticker_file import UploadStickerFile` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: File = await UploadStickerFile(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: File = await bot(UploadStickerFile(...)) + diff --git a/docs2/source/api/session/aiohttp.rst b/docs2/source/api/session/aiohttp.rst new file mode 100644 index 00000000..007dab69 --- /dev/null +++ b/docs2/source/api/session/aiohttp.rst @@ -0,0 +1,92 @@ +####### +aiohttp +####### + +AiohttpSession represents a wrapper-class around `ClientSession` from `aiohttp `_ + +Currently `AiohttpSession` is a default session used in `aiogram.Bot` + +Usage example +============= + +.. code-block:: + + from aiogram import Bot + from aiogram.api.client.session.aiohttp import AiohttpSession + + session = AiohttpSession() + Bot('42:token', session=session) + + +Proxy requests in AiohttpSession +================================ + +In order to use AiohttpSession with proxy connector you have to install `aiohttp-socks `_ + +Binding session to bot: + +.. code-block:: + from aiogram import Bot + from aiogram.api.client.session.aiohttp import AiohttpSession + + session = AiohttpSession(proxy="protocol://host:port/") + Bot(token="bot token", session=session) + + +.. note:: + + Only following protocols are supported: http(tunneling), socks4(a), socks5 + as aiohttp_socks `documentation `_ claims. + + +Authorization +------------- + +Proxy authorization credentials can be specified in proxy URL or come as an instance of :obj:`aiohttp.BasicAuth` containing +login and password. + +Consider examples: + +.. code-block:: + + from aiohttp import BasicAuth + from aiogram.api.client.session.aiohttp import AiohttpSession + + auth = BasicAuth(login="user", password="password") + session = AiohttpSession(proxy=("protocol://host:port", auth)) + + +or simply include your basic auth credential in URL + +.. code-block:: + + session = AiohttpSession(proxy="protocol://user:password@host:port") + + +.. note:: + + Aiogram prefers `BasicAuth` over username and password in URL, so + if proxy URL contains login and password and `BasicAuth` object is passed at the same time + aiogram will use login and password from `BasicAuth` instance. + + +Proxy chains +------------ + +Since `aiohttp-socks `_ supports proxy chains, you're able to use them in aiogram + +Example of chain proxies: + +.. code-block:: + + from aiohttp import BasicAuth + from aiogram.api.client.session.aiohttp import AiohttpSession + + auth = BasicAuth(login="user", password="password") + session = AiohttpSession( + proxy={ + "protocol0://host0:port0", + "protocol1://user:password@host1:port1", + ("protocol2://host2:port2", auth), + } # can be any iterable if not set + ) diff --git a/docs2/source/api/session/base.rst b/docs2/source/api/session/base.rst new file mode 100644 index 00000000..6a1acd19 --- /dev/null +++ b/docs2/source/api/session/base.rst @@ -0,0 +1,8 @@ +#### +Base +#### + +Abstract session for all client sessions + +.. autoclass:: aiogram.api.client.session.base.BaseSession + :members: diff --git a/docs2/source/api/session/index.rst b/docs2/source/api/session/index.rst new file mode 100644 index 00000000..c9ff9cd6 --- /dev/null +++ b/docs2/source/api/session/index.rst @@ -0,0 +1,7 @@ +############## +Client session +############## + +.. toctree:: + base + aiohttp diff --git a/docs2/source/api/types/animation.rst b/docs2/source/api/types/animation.rst new file mode 100644 index 00000000..5092d554 --- /dev/null +++ b/docs2/source/api/types/animation.rst @@ -0,0 +1,8 @@ +######### +Animation +######### + +This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). + +.. automodule:: aiogram.api.types.animation + :members: diff --git a/docs2/source/api/types/audio.rst b/docs2/source/api/types/audio.rst new file mode 100644 index 00000000..403e5e48 --- /dev/null +++ b/docs2/source/api/types/audio.rst @@ -0,0 +1,8 @@ +##### +Audio +##### + +This object represents an audio file to be treated as music by the Telegram clients. + +.. automodule:: aiogram.api.types.audio + :members: diff --git a/docs2/source/api/types/bot_command.rst b/docs2/source/api/types/bot_command.rst new file mode 100644 index 00000000..06f5014f --- /dev/null +++ b/docs2/source/api/types/bot_command.rst @@ -0,0 +1,8 @@ +########## +BotCommand +########## + +This object represents a bot command. + +.. automodule:: aiogram.api.types.bot_command + :members: diff --git a/docs2/source/api/types/callback_game.rst b/docs2/source/api/types/callback_game.rst new file mode 100644 index 00000000..22ab736b --- /dev/null +++ b/docs2/source/api/types/callback_game.rst @@ -0,0 +1,8 @@ +############ +CallbackGame +############ + +A placeholder, currently holds no information. Use BotFather to set up your game. + +.. automodule:: aiogram.api.types.callback_game + :members: diff --git a/docs2/source/api/types/callback_query.rst b/docs2/source/api/types/callback_query.rst new file mode 100644 index 00000000..cb0c33f0 --- /dev/null +++ b/docs2/source/api/types/callback_query.rst @@ -0,0 +1,10 @@ +############# +CallbackQuery +############# + +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). + +.. automodule:: aiogram.api.types.callback_query + :members: diff --git a/docs2/source/api/types/chat.rst b/docs2/source/api/types/chat.rst new file mode 100644 index 00000000..fa14e540 --- /dev/null +++ b/docs2/source/api/types/chat.rst @@ -0,0 +1,8 @@ +#### +Chat +#### + +This object represents a chat. + +.. automodule:: aiogram.api.types.chat + :members: diff --git a/docs2/source/api/types/chat_member.rst b/docs2/source/api/types/chat_member.rst new file mode 100644 index 00000000..eeef4b6f --- /dev/null +++ b/docs2/source/api/types/chat_member.rst @@ -0,0 +1,8 @@ +########## +ChatMember +########## + +This object contains information about one member of a chat. + +.. automodule:: aiogram.api.types.chat_member + :members: diff --git a/docs2/source/api/types/chat_permissions.rst b/docs2/source/api/types/chat_permissions.rst new file mode 100644 index 00000000..7eff2cf5 --- /dev/null +++ b/docs2/source/api/types/chat_permissions.rst @@ -0,0 +1,8 @@ +############### +ChatPermissions +############### + +Describes actions that a non-administrator user is allowed to take in a chat. + +.. automodule:: aiogram.api.types.chat_permissions + :members: diff --git a/docs2/source/api/types/chat_photo.rst b/docs2/source/api/types/chat_photo.rst new file mode 100644 index 00000000..00f4d65f --- /dev/null +++ b/docs2/source/api/types/chat_photo.rst @@ -0,0 +1,8 @@ +######### +ChatPhoto +######### + +This object represents a chat photo. + +.. automodule:: aiogram.api.types.chat_photo + :members: diff --git a/docs2/source/api/types/chosen_inline_result.rst b/docs2/source/api/types/chosen_inline_result.rst new file mode 100644 index 00000000..943731af --- /dev/null +++ b/docs2/source/api/types/chosen_inline_result.rst @@ -0,0 +1,10 @@ +################## +ChosenInlineResult +################## + +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. + +.. automodule:: aiogram.api.types.chosen_inline_result + :members: diff --git a/docs2/source/api/types/contact.rst b/docs2/source/api/types/contact.rst new file mode 100644 index 00000000..dbde7bcf --- /dev/null +++ b/docs2/source/api/types/contact.rst @@ -0,0 +1,8 @@ +####### +Contact +####### + +This object represents a phone contact. + +.. automodule:: aiogram.api.types.contact + :members: diff --git a/docs2/source/api/types/dice.rst b/docs2/source/api/types/dice.rst new file mode 100644 index 00000000..90450051 --- /dev/null +++ b/docs2/source/api/types/dice.rst @@ -0,0 +1,8 @@ +#### +Dice +#### + +This object represents an animated emoji that displays a random value. + +.. automodule:: aiogram.api.types.dice + :members: diff --git a/docs2/source/api/types/document.rst b/docs2/source/api/types/document.rst new file mode 100644 index 00000000..fe497113 --- /dev/null +++ b/docs2/source/api/types/document.rst @@ -0,0 +1,8 @@ +######## +Document +######## + +This object represents a general file (as opposed to photos, voice messages and audio files). + +.. automodule:: aiogram.api.types.document + :members: diff --git a/docs2/source/api/types/encrypted_credentials.rst b/docs2/source/api/types/encrypted_credentials.rst new file mode 100644 index 00000000..08bff496 --- /dev/null +++ b/docs2/source/api/types/encrypted_credentials.rst @@ -0,0 +1,8 @@ +#################### +EncryptedCredentials +#################### + +Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. + +.. automodule:: aiogram.api.types.encrypted_credentials + :members: diff --git a/docs2/source/api/types/encrypted_passport_element.rst b/docs2/source/api/types/encrypted_passport_element.rst new file mode 100644 index 00000000..3e187d57 --- /dev/null +++ b/docs2/source/api/types/encrypted_passport_element.rst @@ -0,0 +1,8 @@ +######################## +EncryptedPassportElement +######################## + +Contains information about documents or other Telegram Passport elements shared with the bot by the user. + +.. automodule:: aiogram.api.types.encrypted_passport_element + :members: diff --git a/docs2/source/api/types/file.rst b/docs2/source/api/types/file.rst new file mode 100644 index 00000000..baa7c2de --- /dev/null +++ b/docs2/source/api/types/file.rst @@ -0,0 +1,10 @@ +#### +File +#### + +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 + +.. automodule:: aiogram.api.types.file + :members: diff --git a/docs2/source/api/types/force_reply.rst b/docs2/source/api/types/force_reply.rst new file mode 100644 index 00000000..8fa98336 --- /dev/null +++ b/docs2/source/api/types/force_reply.rst @@ -0,0 +1,18 @@ +########## +ForceReply +########## + +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. + +.. automodule:: aiogram.api.types.force_reply + :members: diff --git a/docs2/source/api/types/game.rst b/docs2/source/api/types/game.rst new file mode 100644 index 00000000..ad9095c2 --- /dev/null +++ b/docs2/source/api/types/game.rst @@ -0,0 +1,8 @@ +#### +Game +#### + +This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. + +.. automodule:: aiogram.api.types.game + :members: diff --git a/docs2/source/api/types/game_high_score.rst b/docs2/source/api/types/game_high_score.rst new file mode 100644 index 00000000..8551d3be --- /dev/null +++ b/docs2/source/api/types/game_high_score.rst @@ -0,0 +1,12 @@ +############# +GameHighScore +############# + +This object represents one row of the high scores table for a game. + +And that's about all we've got for now. + +If you've got any questions, please check out our Bot FAQ + +.. automodule:: aiogram.api.types.game_high_score + :members: diff --git a/docs2/source/api/types/index.rst b/docs2/source/api/types/index.rst new file mode 100644 index 00000000..5cfb1974 --- /dev/null +++ b/docs2/source/api/types/index.rst @@ -0,0 +1,160 @@ +##### +Types +##### + +All types is also wrapped with `pydantic `_ and placed in `aiogram.api.types` package. +In this place makes some more differences with official documentations: + +- name :attr:`from` was renamed to :attr:`from_user` in due to :attr:`from` is an `keyword in python `_ +- timestamps has :class:`datetime.datetime` type instead of :class:`int` +- InputFile is used for sending files and is not use `pydantic.BaseModel` as base class + +Getting updates +=============== + +.. toctree:: + :maxdepth: 1 + + update + webhook_info + +Available types +=============== + +.. toctree:: + :maxdepth: 1 + + user + chat + message + message_entity + photo_size + animation + audio + document + video + video_note + voice + contact + dice + poll_option + poll_answer + poll + location + venue + user_profile_photos + file + reply_keyboard_markup + keyboard_button + keyboard_button_poll_type + reply_keyboard_remove + inline_keyboard_markup + inline_keyboard_button + login_url + callback_query + force_reply + chat_photo + chat_member + chat_permissions + bot_command + response_parameters + input_media + input_media_photo + input_media_video + input_media_animation + input_media_audio + input_media_document + input_file + + + +Stickers +======== + +.. toctree:: + :maxdepth: 1 + + sticker + sticker_set + mask_position + +Inline mode +=========== + +.. toctree:: + :maxdepth: 1 + + inline_query + inline_query_result + inline_query_result_article + inline_query_result_photo + inline_query_result_gif + inline_query_result_mpeg4_gif + inline_query_result_video + inline_query_result_audio + inline_query_result_voice + inline_query_result_document + inline_query_result_location + inline_query_result_venue + inline_query_result_contact + inline_query_result_game + inline_query_result_cached_photo + inline_query_result_cached_gif + inline_query_result_cached_mpeg4_gif + inline_query_result_cached_sticker + inline_query_result_cached_document + inline_query_result_cached_video + inline_query_result_cached_voice + inline_query_result_cached_audio + input_message_content + input_text_message_content + input_location_message_content + input_venue_message_content + input_contact_message_content + chosen_inline_result + +Payments +======== + +.. toctree:: + :maxdepth: 1 + + labeled_price + invoice + shipping_address + order_info + shipping_option + successful_payment + shipping_query + pre_checkout_query + +Telegram Passport +================= + +.. toctree:: + :maxdepth: 1 + + passport_data + passport_file + encrypted_passport_element + encrypted_credentials + passport_element_error + passport_element_error_data_field + passport_element_error_front_side + passport_element_error_reverse_side + passport_element_error_selfie + passport_element_error_file + passport_element_error_files + passport_element_error_translation_file + passport_element_error_translation_files + passport_element_error_unspecified + +Games +===== + +.. toctree:: + :maxdepth: 1 + + game + callback_game + game_high_score diff --git a/docs2/source/api/types/inline_keyboard_button.rst b/docs2/source/api/types/inline_keyboard_button.rst new file mode 100644 index 00000000..62d7118d --- /dev/null +++ b/docs2/source/api/types/inline_keyboard_button.rst @@ -0,0 +1,8 @@ +#################### +InlineKeyboardButton +#################### + +This object represents one button of an inline keyboard. You must use exactly one of the optional fields. + +.. automodule:: aiogram.api.types.inline_keyboard_button + :members: diff --git a/docs2/source/api/types/inline_keyboard_markup.rst b/docs2/source/api/types/inline_keyboard_markup.rst new file mode 100644 index 00000000..56d4ca31 --- /dev/null +++ b/docs2/source/api/types/inline_keyboard_markup.rst @@ -0,0 +1,10 @@ +#################### +InlineKeyboardMarkup +#################### + +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. + +.. automodule:: aiogram.api.types.inline_keyboard_markup + :members: diff --git a/docs2/source/api/types/inline_query.rst b/docs2/source/api/types/inline_query.rst new file mode 100644 index 00000000..4ba13dc5 --- /dev/null +++ b/docs2/source/api/types/inline_query.rst @@ -0,0 +1,8 @@ +########### +InlineQuery +########### + +This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. + +.. automodule:: aiogram.api.types.inline_query + :members: diff --git a/docs2/source/api/types/inline_query_result.rst b/docs2/source/api/types/inline_query_result.rst new file mode 100644 index 00000000..c798f40e --- /dev/null +++ b/docs2/source/api/types/inline_query_result.rst @@ -0,0 +1,48 @@ +################# +InlineQueryResult +################# + +This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: + + - InlineQueryResultCachedAudio + + - InlineQueryResultCachedDocument + + - InlineQueryResultCachedGif + + - InlineQueryResultCachedMpeg4Gif + + - InlineQueryResultCachedPhoto + + - InlineQueryResultCachedSticker + + - InlineQueryResultCachedVideo + + - InlineQueryResultCachedVoice + + - InlineQueryResultArticle + + - InlineQueryResultAudio + + - InlineQueryResultContact + + - InlineQueryResultGame + + - InlineQueryResultDocument + + - InlineQueryResultGif + + - InlineQueryResultLocation + + - InlineQueryResultMpeg4Gif + + - InlineQueryResultPhoto + + - InlineQueryResultVenue + + - InlineQueryResultVideo + + - InlineQueryResultVoice + +.. automodule:: aiogram.api.types.inline_query_result + :members: diff --git a/docs2/source/api/types/inline_query_result_article.rst b/docs2/source/api/types/inline_query_result_article.rst new file mode 100644 index 00000000..eae120c6 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_article.rst @@ -0,0 +1,8 @@ +######################## +InlineQueryResultArticle +######################## + +Represents a link to an article or web page. + +.. automodule:: aiogram.api.types.inline_query_result_article + :members: diff --git a/docs2/source/api/types/inline_query_result_audio.rst b/docs2/source/api/types/inline_query_result_audio.rst new file mode 100644 index 00000000..cf99a00e --- /dev/null +++ b/docs2/source/api/types/inline_query_result_audio.rst @@ -0,0 +1,10 @@ +###################### +InlineQueryResultAudio +###################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_audio + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_audio.rst b/docs2/source/api/types/inline_query_result_cached_audio.rst new file mode 100644 index 00000000..e3faf146 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_audio.rst @@ -0,0 +1,10 @@ +############################ +InlineQueryResultCachedAudio +############################ + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_audio + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_document.rst b/docs2/source/api/types/inline_query_result_cached_document.rst new file mode 100644 index 00000000..89420202 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_document.rst @@ -0,0 +1,10 @@ +############################### +InlineQueryResultCachedDocument +############################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_document + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_gif.rst b/docs2/source/api/types/inline_query_result_cached_gif.rst new file mode 100644 index 00000000..7c593220 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_gif.rst @@ -0,0 +1,8 @@ +########################## +InlineQueryResultCachedGif +########################## + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_gif + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_mpeg4_gif.rst b/docs2/source/api/types/inline_query_result_cached_mpeg4_gif.rst new file mode 100644 index 00000000..5cb2523a --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_mpeg4_gif.rst @@ -0,0 +1,8 @@ +############################### +InlineQueryResultCachedMpeg4Gif +############################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_mpeg4_gif + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_photo.rst b/docs2/source/api/types/inline_query_result_cached_photo.rst new file mode 100644 index 00000000..79c558f8 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_photo.rst @@ -0,0 +1,8 @@ +############################ +InlineQueryResultCachedPhoto +############################ + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_photo + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_sticker.rst b/docs2/source/api/types/inline_query_result_cached_sticker.rst new file mode 100644 index 00000000..0bff87a6 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_sticker.rst @@ -0,0 +1,10 @@ +############################## +InlineQueryResultCachedSticker +############################## + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_sticker + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_video.rst b/docs2/source/api/types/inline_query_result_cached_video.rst new file mode 100644 index 00000000..b608887d --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_video.rst @@ -0,0 +1,8 @@ +############################ +InlineQueryResultCachedVideo +############################ + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_video + :members: diff --git a/docs2/source/api/types/inline_query_result_cached_voice.rst b/docs2/source/api/types/inline_query_result_cached_voice.rst new file mode 100644 index 00000000..438bc1e7 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_cached_voice.rst @@ -0,0 +1,10 @@ +############################ +InlineQueryResultCachedVoice +############################ + +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. + +.. automodule:: aiogram.api.types.inline_query_result_cached_voice + :members: diff --git a/docs2/source/api/types/inline_query_result_contact.rst b/docs2/source/api/types/inline_query_result_contact.rst new file mode 100644 index 00000000..ecb2d55a --- /dev/null +++ b/docs2/source/api/types/inline_query_result_contact.rst @@ -0,0 +1,10 @@ +######################## +InlineQueryResultContact +######################## + +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. + +.. automodule:: aiogram.api.types.inline_query_result_contact + :members: diff --git a/docs2/source/api/types/inline_query_result_document.rst b/docs2/source/api/types/inline_query_result_document.rst new file mode 100644 index 00000000..6800b525 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_document.rst @@ -0,0 +1,10 @@ +######################### +InlineQueryResultDocument +######################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_document + :members: diff --git a/docs2/source/api/types/inline_query_result_game.rst b/docs2/source/api/types/inline_query_result_game.rst new file mode 100644 index 00000000..9fb4527b --- /dev/null +++ b/docs2/source/api/types/inline_query_result_game.rst @@ -0,0 +1,10 @@ +##################### +InlineQueryResultGame +##################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_game + :members: diff --git a/docs2/source/api/types/inline_query_result_gif.rst b/docs2/source/api/types/inline_query_result_gif.rst new file mode 100644 index 00000000..a087a4fe --- /dev/null +++ b/docs2/source/api/types/inline_query_result_gif.rst @@ -0,0 +1,8 @@ +#################### +InlineQueryResultGif +#################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_gif + :members: diff --git a/docs2/source/api/types/inline_query_result_location.rst b/docs2/source/api/types/inline_query_result_location.rst new file mode 100644 index 00000000..6f6def63 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_location.rst @@ -0,0 +1,10 @@ +######################### +InlineQueryResultLocation +######################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_location + :members: diff --git a/docs2/source/api/types/inline_query_result_mpeg4_gif.rst b/docs2/source/api/types/inline_query_result_mpeg4_gif.rst new file mode 100644 index 00000000..6763df77 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_mpeg4_gif.rst @@ -0,0 +1,8 @@ +######################### +InlineQueryResultMpeg4Gif +######################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_mpeg4_gif + :members: diff --git a/docs2/source/api/types/inline_query_result_photo.rst b/docs2/source/api/types/inline_query_result_photo.rst new file mode 100644 index 00000000..0f5cc435 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_photo.rst @@ -0,0 +1,8 @@ +###################### +InlineQueryResultPhoto +###################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_photo + :members: diff --git a/docs2/source/api/types/inline_query_result_venue.rst b/docs2/source/api/types/inline_query_result_venue.rst new file mode 100644 index 00000000..dfc20d72 --- /dev/null +++ b/docs2/source/api/types/inline_query_result_venue.rst @@ -0,0 +1,10 @@ +###################### +InlineQueryResultVenue +###################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_venue + :members: diff --git a/docs2/source/api/types/inline_query_result_video.rst b/docs2/source/api/types/inline_query_result_video.rst new file mode 100644 index 00000000..4dad781c --- /dev/null +++ b/docs2/source/api/types/inline_query_result_video.rst @@ -0,0 +1,10 @@ +###################### +InlineQueryResultVideo +###################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_video + :members: diff --git a/docs2/source/api/types/inline_query_result_voice.rst b/docs2/source/api/types/inline_query_result_voice.rst new file mode 100644 index 00000000..8c86958e --- /dev/null +++ b/docs2/source/api/types/inline_query_result_voice.rst @@ -0,0 +1,10 @@ +###################### +InlineQueryResultVoice +###################### + +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. + +.. automodule:: aiogram.api.types.inline_query_result_voice + :members: diff --git a/docs2/source/api/types/input_contact_message_content.rst b/docs2/source/api/types/input_contact_message_content.rst new file mode 100644 index 00000000..986fda0d --- /dev/null +++ b/docs2/source/api/types/input_contact_message_content.rst @@ -0,0 +1,8 @@ +########################## +InputContactMessageContent +########################## + +Represents the content of a contact message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_contact_message_content + :members: diff --git a/docs2/source/api/types/input_file.rst b/docs2/source/api/types/input_file.rst new file mode 100644 index 00000000..1304bf28 --- /dev/null +++ b/docs2/source/api/types/input_file.rst @@ -0,0 +1,8 @@ +######### +InputFile +######### + +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. + +.. automodule:: aiogram.api.types.input_file + :members: diff --git a/docs2/source/api/types/input_location_message_content.rst b/docs2/source/api/types/input_location_message_content.rst new file mode 100644 index 00000000..1a18d4d6 --- /dev/null +++ b/docs2/source/api/types/input_location_message_content.rst @@ -0,0 +1,8 @@ +########################### +InputLocationMessageContent +########################### + +Represents the content of a location message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_location_message_content + :members: diff --git a/docs2/source/api/types/input_media.rst b/docs2/source/api/types/input_media.rst new file mode 100644 index 00000000..8d4fd958 --- /dev/null +++ b/docs2/source/api/types/input_media.rst @@ -0,0 +1,18 @@ +########## +InputMedia +########## + +This object represents the content of a media message to be sent. It should be one of + + - InputMediaAnimation + + - InputMediaDocument + + - InputMediaAudio + + - InputMediaPhoto + + - InputMediaVideo + +.. automodule:: aiogram.api.types.input_media + :members: diff --git a/docs2/source/api/types/input_media_animation.rst b/docs2/source/api/types/input_media_animation.rst new file mode 100644 index 00000000..02064f4e --- /dev/null +++ b/docs2/source/api/types/input_media_animation.rst @@ -0,0 +1,8 @@ +################### +InputMediaAnimation +################### + +Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. + +.. automodule:: aiogram.api.types.input_media_animation + :members: diff --git a/docs2/source/api/types/input_media_audio.rst b/docs2/source/api/types/input_media_audio.rst new file mode 100644 index 00000000..a7fa516b --- /dev/null +++ b/docs2/source/api/types/input_media_audio.rst @@ -0,0 +1,8 @@ +############### +InputMediaAudio +############### + +Represents an audio file to be treated as music to be sent. + +.. automodule:: aiogram.api.types.input_media_audio + :members: diff --git a/docs2/source/api/types/input_media_document.rst b/docs2/source/api/types/input_media_document.rst new file mode 100644 index 00000000..f50dd71e --- /dev/null +++ b/docs2/source/api/types/input_media_document.rst @@ -0,0 +1,8 @@ +################## +InputMediaDocument +################## + +Represents a general file to be sent. + +.. automodule:: aiogram.api.types.input_media_document + :members: diff --git a/docs2/source/api/types/input_media_photo.rst b/docs2/source/api/types/input_media_photo.rst new file mode 100644 index 00000000..937e0524 --- /dev/null +++ b/docs2/source/api/types/input_media_photo.rst @@ -0,0 +1,8 @@ +############### +InputMediaPhoto +############### + +Represents a photo to be sent. + +.. automodule:: aiogram.api.types.input_media_photo + :members: diff --git a/docs2/source/api/types/input_media_video.rst b/docs2/source/api/types/input_media_video.rst new file mode 100644 index 00000000..9f3d104d --- /dev/null +++ b/docs2/source/api/types/input_media_video.rst @@ -0,0 +1,8 @@ +############### +InputMediaVideo +############### + +Represents a video to be sent. + +.. automodule:: aiogram.api.types.input_media_video + :members: diff --git a/docs2/source/api/types/input_message_content.rst b/docs2/source/api/types/input_message_content.rst new file mode 100644 index 00000000..0f902053 --- /dev/null +++ b/docs2/source/api/types/input_message_content.rst @@ -0,0 +1,16 @@ +################### +InputMessageContent +################### + +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 + + - InputContactMessageContent + +.. automodule:: aiogram.api.types.input_message_content + :members: diff --git a/docs2/source/api/types/input_text_message_content.rst b/docs2/source/api/types/input_text_message_content.rst new file mode 100644 index 00000000..48b9b608 --- /dev/null +++ b/docs2/source/api/types/input_text_message_content.rst @@ -0,0 +1,8 @@ +####################### +InputTextMessageContent +####################### + +Represents the content of a text message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_text_message_content + :members: diff --git a/docs2/source/api/types/input_venue_message_content.rst b/docs2/source/api/types/input_venue_message_content.rst new file mode 100644 index 00000000..679f10eb --- /dev/null +++ b/docs2/source/api/types/input_venue_message_content.rst @@ -0,0 +1,8 @@ +######################## +InputVenueMessageContent +######################## + +Represents the content of a venue message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_venue_message_content + :members: diff --git a/docs2/source/api/types/invoice.rst b/docs2/source/api/types/invoice.rst new file mode 100644 index 00000000..33f49597 --- /dev/null +++ b/docs2/source/api/types/invoice.rst @@ -0,0 +1,8 @@ +####### +Invoice +####### + +This object contains basic information about an invoice. + +.. automodule:: aiogram.api.types.invoice + :members: diff --git a/docs2/source/api/types/keyboard_button.rst b/docs2/source/api/types/keyboard_button.rst new file mode 100644 index 00000000..9135d3cb --- /dev/null +++ b/docs2/source/api/types/keyboard_button.rst @@ -0,0 +1,12 @@ +############## +KeyboardButton +############## + +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 request_contact, request_location, and request_poll are mutually exclusive. + +Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. + +Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will display unsupported message. + +.. automodule:: aiogram.api.types.keyboard_button + :members: diff --git a/docs2/source/api/types/keyboard_button_poll_type.rst b/docs2/source/api/types/keyboard_button_poll_type.rst new file mode 100644 index 00000000..6ba3a378 --- /dev/null +++ b/docs2/source/api/types/keyboard_button_poll_type.rst @@ -0,0 +1,8 @@ +###################### +KeyboardButtonPollType +###################### + +This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. + +.. automodule:: aiogram.api.types.keyboard_button_poll_type + :members: diff --git a/docs2/source/api/types/labeled_price.rst b/docs2/source/api/types/labeled_price.rst new file mode 100644 index 00000000..c54459c6 --- /dev/null +++ b/docs2/source/api/types/labeled_price.rst @@ -0,0 +1,8 @@ +############ +LabeledPrice +############ + +This object represents a portion of the price for goods or services. + +.. automodule:: aiogram.api.types.labeled_price + :members: diff --git a/docs2/source/api/types/location.rst b/docs2/source/api/types/location.rst new file mode 100644 index 00000000..2e7bee9a --- /dev/null +++ b/docs2/source/api/types/location.rst @@ -0,0 +1,8 @@ +######## +Location +######## + +This object represents a point on the map. + +.. automodule:: aiogram.api.types.location + :members: diff --git a/docs2/source/api/types/login_url.rst b/docs2/source/api/types/login_url.rst new file mode 100644 index 00000000..fba92503 --- /dev/null +++ b/docs2/source/api/types/login_url.rst @@ -0,0 +1,12 @@ +######## +LoginUrl +######## + +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 + +.. automodule:: aiogram.api.types.login_url + :members: diff --git a/docs2/source/api/types/mask_position.rst b/docs2/source/api/types/mask_position.rst new file mode 100644 index 00000000..f0101572 --- /dev/null +++ b/docs2/source/api/types/mask_position.rst @@ -0,0 +1,8 @@ +############ +MaskPosition +############ + +This object describes the position on faces where a mask should be placed by default. + +.. automodule:: aiogram.api.types.mask_position + :members: diff --git a/docs2/source/api/types/message.rst b/docs2/source/api/types/message.rst new file mode 100644 index 00000000..4603c9f2 --- /dev/null +++ b/docs2/source/api/types/message.rst @@ -0,0 +1,8 @@ +####### +Message +####### + +This object represents a message. + +.. automodule:: aiogram.api.types.message + :members: diff --git a/docs2/source/api/types/message_entity.rst b/docs2/source/api/types/message_entity.rst new file mode 100644 index 00000000..ba3a35a2 --- /dev/null +++ b/docs2/source/api/types/message_entity.rst @@ -0,0 +1,8 @@ +############# +MessageEntity +############# + +This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. + +.. automodule:: aiogram.api.types.message_entity + :members: diff --git a/docs2/source/api/types/order_info.rst b/docs2/source/api/types/order_info.rst new file mode 100644 index 00000000..080e56fb --- /dev/null +++ b/docs2/source/api/types/order_info.rst @@ -0,0 +1,8 @@ +######### +OrderInfo +######### + +This object represents information about an order. + +.. automodule:: aiogram.api.types.order_info + :members: diff --git a/docs2/source/api/types/passport_data.rst b/docs2/source/api/types/passport_data.rst new file mode 100644 index 00000000..36a86c2b --- /dev/null +++ b/docs2/source/api/types/passport_data.rst @@ -0,0 +1,8 @@ +############ +PassportData +############ + +Contains information about Telegram Passport data shared with the bot by the user. + +.. automodule:: aiogram.api.types.passport_data + :members: diff --git a/docs2/source/api/types/passport_element_error.rst b/docs2/source/api/types/passport_element_error.rst new file mode 100644 index 00000000..9713d2b7 --- /dev/null +++ b/docs2/source/api/types/passport_element_error.rst @@ -0,0 +1,26 @@ +#################### +PassportElementError +#################### + +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 + + - PassportElementErrorSelfie + + - PassportElementErrorFile + + - PassportElementErrorFiles + + - PassportElementErrorTranslationFile + + - PassportElementErrorTranslationFiles + + - PassportElementErrorUnspecified + +.. automodule:: aiogram.api.types.passport_element_error + :members: diff --git a/docs2/source/api/types/passport_element_error_data_field.rst b/docs2/source/api/types/passport_element_error_data_field.rst new file mode 100644 index 00000000..ddcbba8e --- /dev/null +++ b/docs2/source/api/types/passport_element_error_data_field.rst @@ -0,0 +1,8 @@ +############################# +PassportElementErrorDataField +############################# + +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. + +.. automodule:: aiogram.api.types.passport_element_error_data_field + :members: diff --git a/docs2/source/api/types/passport_element_error_file.rst b/docs2/source/api/types/passport_element_error_file.rst new file mode 100644 index 00000000..ee26e42a --- /dev/null +++ b/docs2/source/api/types/passport_element_error_file.rst @@ -0,0 +1,8 @@ +######################## +PassportElementErrorFile +######################## + +Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. + +.. automodule:: aiogram.api.types.passport_element_error_file + :members: diff --git a/docs2/source/api/types/passport_element_error_files.rst b/docs2/source/api/types/passport_element_error_files.rst new file mode 100644 index 00000000..107a5725 --- /dev/null +++ b/docs2/source/api/types/passport_element_error_files.rst @@ -0,0 +1,8 @@ +######################### +PassportElementErrorFiles +######################### + +Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. + +.. automodule:: aiogram.api.types.passport_element_error_files + :members: diff --git a/docs2/source/api/types/passport_element_error_front_side.rst b/docs2/source/api/types/passport_element_error_front_side.rst new file mode 100644 index 00000000..8920fb40 --- /dev/null +++ b/docs2/source/api/types/passport_element_error_front_side.rst @@ -0,0 +1,8 @@ +############################# +PassportElementErrorFrontSide +############################# + +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. + +.. automodule:: aiogram.api.types.passport_element_error_front_side + :members: diff --git a/docs2/source/api/types/passport_element_error_reverse_side.rst b/docs2/source/api/types/passport_element_error_reverse_side.rst new file mode 100644 index 00000000..298926e0 --- /dev/null +++ b/docs2/source/api/types/passport_element_error_reverse_side.rst @@ -0,0 +1,8 @@ +############################### +PassportElementErrorReverseSide +############################### + +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. + +.. automodule:: aiogram.api.types.passport_element_error_reverse_side + :members: diff --git a/docs2/source/api/types/passport_element_error_selfie.rst b/docs2/source/api/types/passport_element_error_selfie.rst new file mode 100644 index 00000000..1817a1bf --- /dev/null +++ b/docs2/source/api/types/passport_element_error_selfie.rst @@ -0,0 +1,8 @@ +########################## +PassportElementErrorSelfie +########################## + +Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. + +.. automodule:: aiogram.api.types.passport_element_error_selfie + :members: diff --git a/docs2/source/api/types/passport_element_error_translation_file.rst b/docs2/source/api/types/passport_element_error_translation_file.rst new file mode 100644 index 00000000..7ffed848 --- /dev/null +++ b/docs2/source/api/types/passport_element_error_translation_file.rst @@ -0,0 +1,8 @@ +################################### +PassportElementErrorTranslationFile +################################### + +Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. + +.. automodule:: aiogram.api.types.passport_element_error_translation_file + :members: diff --git a/docs2/source/api/types/passport_element_error_translation_files.rst b/docs2/source/api/types/passport_element_error_translation_files.rst new file mode 100644 index 00000000..0ce363e1 --- /dev/null +++ b/docs2/source/api/types/passport_element_error_translation_files.rst @@ -0,0 +1,8 @@ +#################################### +PassportElementErrorTranslationFiles +#################################### + +Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. + +.. automodule:: aiogram.api.types.passport_element_error_translation_files + :members: diff --git a/docs2/source/api/types/passport_element_error_unspecified.rst b/docs2/source/api/types/passport_element_error_unspecified.rst new file mode 100644 index 00000000..245acf4a --- /dev/null +++ b/docs2/source/api/types/passport_element_error_unspecified.rst @@ -0,0 +1,8 @@ +############################### +PassportElementErrorUnspecified +############################### + +Represents an issue in an unspecified place. The error is considered resolved when new data is added. + +.. automodule:: aiogram.api.types.passport_element_error_unspecified + :members: diff --git a/docs2/source/api/types/passport_file.rst b/docs2/source/api/types/passport_file.rst new file mode 100644 index 00000000..4b7c1446 --- /dev/null +++ b/docs2/source/api/types/passport_file.rst @@ -0,0 +1,8 @@ +############ +PassportFile +############ + +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. + +.. automodule:: aiogram.api.types.passport_file + :members: diff --git a/docs2/source/api/types/photo_size.rst b/docs2/source/api/types/photo_size.rst new file mode 100644 index 00000000..3ede4355 --- /dev/null +++ b/docs2/source/api/types/photo_size.rst @@ -0,0 +1,8 @@ +######### +PhotoSize +######### + +This object represents one size of a photo or a file / sticker thumbnail. + +.. automodule:: aiogram.api.types.photo_size + :members: diff --git a/docs2/source/api/types/poll.rst b/docs2/source/api/types/poll.rst new file mode 100644 index 00000000..ed8df745 --- /dev/null +++ b/docs2/source/api/types/poll.rst @@ -0,0 +1,8 @@ +#### +Poll +#### + +This object contains information about a poll. + +.. automodule:: aiogram.api.types.poll + :members: diff --git a/docs2/source/api/types/poll_answer.rst b/docs2/source/api/types/poll_answer.rst new file mode 100644 index 00000000..ecd84970 --- /dev/null +++ b/docs2/source/api/types/poll_answer.rst @@ -0,0 +1,8 @@ +########## +PollAnswer +########## + +This object represents an answer of a user in a non-anonymous poll. + +.. automodule:: aiogram.api.types.poll_answer + :members: diff --git a/docs2/source/api/types/poll_option.rst b/docs2/source/api/types/poll_option.rst new file mode 100644 index 00000000..33e93b02 --- /dev/null +++ b/docs2/source/api/types/poll_option.rst @@ -0,0 +1,8 @@ +########## +PollOption +########## + +This object contains information about one answer option in a poll. + +.. automodule:: aiogram.api.types.poll_option + :members: diff --git a/docs2/source/api/types/pre_checkout_query.rst b/docs2/source/api/types/pre_checkout_query.rst new file mode 100644 index 00000000..a2fba195 --- /dev/null +++ b/docs2/source/api/types/pre_checkout_query.rst @@ -0,0 +1,8 @@ +################ +PreCheckoutQuery +################ + +This object contains information about an incoming pre-checkout query. + +.. automodule:: aiogram.api.types.pre_checkout_query + :members: diff --git a/docs2/source/api/types/reply_keyboard_markup.rst b/docs2/source/api/types/reply_keyboard_markup.rst new file mode 100644 index 00000000..aa038328 --- /dev/null +++ b/docs2/source/api/types/reply_keyboard_markup.rst @@ -0,0 +1,8 @@ +################### +ReplyKeyboardMarkup +################### + +This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). + +.. automodule:: aiogram.api.types.reply_keyboard_markup + :members: diff --git a/docs2/source/api/types/reply_keyboard_remove.rst b/docs2/source/api/types/reply_keyboard_remove.rst new file mode 100644 index 00000000..253bdbce --- /dev/null +++ b/docs2/source/api/types/reply_keyboard_remove.rst @@ -0,0 +1,8 @@ +################### +ReplyKeyboardRemove +################### + +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). + +.. automodule:: aiogram.api.types.reply_keyboard_remove + :members: diff --git a/docs2/source/api/types/response_parameters.rst b/docs2/source/api/types/response_parameters.rst new file mode 100644 index 00000000..fd4a2aba --- /dev/null +++ b/docs2/source/api/types/response_parameters.rst @@ -0,0 +1,8 @@ +################## +ResponseParameters +################## + +Contains information about why a request was unsuccessful. + +.. automodule:: aiogram.api.types.response_parameters + :members: diff --git a/docs2/source/api/types/shipping_address.rst b/docs2/source/api/types/shipping_address.rst new file mode 100644 index 00000000..4358ce06 --- /dev/null +++ b/docs2/source/api/types/shipping_address.rst @@ -0,0 +1,8 @@ +############### +ShippingAddress +############### + +This object represents a shipping address. + +.. automodule:: aiogram.api.types.shipping_address + :members: diff --git a/docs2/source/api/types/shipping_option.rst b/docs2/source/api/types/shipping_option.rst new file mode 100644 index 00000000..4845b9ea --- /dev/null +++ b/docs2/source/api/types/shipping_option.rst @@ -0,0 +1,8 @@ +############## +ShippingOption +############## + +This object represents one shipping option. + +.. automodule:: aiogram.api.types.shipping_option + :members: diff --git a/docs2/source/api/types/shipping_query.rst b/docs2/source/api/types/shipping_query.rst new file mode 100644 index 00000000..0e043612 --- /dev/null +++ b/docs2/source/api/types/shipping_query.rst @@ -0,0 +1,8 @@ +############# +ShippingQuery +############# + +This object contains information about an incoming shipping query. + +.. automodule:: aiogram.api.types.shipping_query + :members: diff --git a/docs2/source/api/types/sticker.rst b/docs2/source/api/types/sticker.rst new file mode 100644 index 00000000..58183b01 --- /dev/null +++ b/docs2/source/api/types/sticker.rst @@ -0,0 +1,8 @@ +####### +Sticker +####### + +This object represents a sticker. + +.. automodule:: aiogram.api.types.sticker + :members: diff --git a/docs2/source/api/types/sticker_set.rst b/docs2/source/api/types/sticker_set.rst new file mode 100644 index 00000000..fa99ffa1 --- /dev/null +++ b/docs2/source/api/types/sticker_set.rst @@ -0,0 +1,8 @@ +########## +StickerSet +########## + +This object represents a sticker set. + +.. automodule:: aiogram.api.types.sticker_set + :members: diff --git a/docs2/source/api/types/successful_payment.rst b/docs2/source/api/types/successful_payment.rst new file mode 100644 index 00000000..771d671f --- /dev/null +++ b/docs2/source/api/types/successful_payment.rst @@ -0,0 +1,8 @@ +################# +SuccessfulPayment +################# + +This object contains basic information about a successful payment. + +.. automodule:: aiogram.api.types.successful_payment + :members: diff --git a/docs2/source/api/types/update.rst b/docs2/source/api/types/update.rst new file mode 100644 index 00000000..60a6a8f2 --- /dev/null +++ b/docs2/source/api/types/update.rst @@ -0,0 +1,10 @@ +###### +Update +###### + +This object represents an incoming update. + +At most one of the optional parameters can be present in any given update. + +.. automodule:: aiogram.api.types.update + :members: diff --git a/docs2/source/api/types/user.rst b/docs2/source/api/types/user.rst new file mode 100644 index 00000000..f40dc099 --- /dev/null +++ b/docs2/source/api/types/user.rst @@ -0,0 +1,8 @@ +#### +User +#### + +This object represents a Telegram user or bot. + +.. automodule:: aiogram.api.types.user + :members: diff --git a/docs2/source/api/types/user_profile_photos.rst b/docs2/source/api/types/user_profile_photos.rst new file mode 100644 index 00000000..3488c79f --- /dev/null +++ b/docs2/source/api/types/user_profile_photos.rst @@ -0,0 +1,8 @@ +################# +UserProfilePhotos +################# + +This object represent a user's profile pictures. + +.. automodule:: aiogram.api.types.user_profile_photos + :members: diff --git a/docs2/source/api/types/venue.rst b/docs2/source/api/types/venue.rst new file mode 100644 index 00000000..37f278bc --- /dev/null +++ b/docs2/source/api/types/venue.rst @@ -0,0 +1,8 @@ +##### +Venue +##### + +This object represents a venue. + +.. automodule:: aiogram.api.types.venue + :members: diff --git a/docs2/source/api/types/video.rst b/docs2/source/api/types/video.rst new file mode 100644 index 00000000..0444003f --- /dev/null +++ b/docs2/source/api/types/video.rst @@ -0,0 +1,8 @@ +##### +Video +##### + +This object represents a video file. + +.. automodule:: aiogram.api.types.video + :members: diff --git a/docs2/source/api/types/video_note.rst b/docs2/source/api/types/video_note.rst new file mode 100644 index 00000000..1b26867d --- /dev/null +++ b/docs2/source/api/types/video_note.rst @@ -0,0 +1,8 @@ +######### +VideoNote +######### + +This object represents a video message (available in Telegram apps as of v.4.0). + +.. automodule:: aiogram.api.types.video_note + :members: diff --git a/docs2/source/api/types/voice.rst b/docs2/source/api/types/voice.rst new file mode 100644 index 00000000..c6af7008 --- /dev/null +++ b/docs2/source/api/types/voice.rst @@ -0,0 +1,8 @@ +##### +Voice +##### + +This object represents a voice note. + +.. automodule:: aiogram.api.types.voice + :members: diff --git a/docs2/source/api/types/webhook_info.rst b/docs2/source/api/types/webhook_info.rst new file mode 100644 index 00000000..c46d5675 --- /dev/null +++ b/docs2/source/api/types/webhook_info.rst @@ -0,0 +1,8 @@ +########### +WebhookInfo +########### + +Contains information about the current status of a webhook. + +.. automodule:: aiogram.api.types.webhook_info + :members: diff --git a/docs2/source/api/upload_file.rst b/docs2/source/api/upload_file.rst new file mode 100644 index 00000000..9e63754b --- /dev/null +++ b/docs2/source/api/upload_file.rst @@ -0,0 +1,94 @@ +################### +How to upload file? +################### + +As says `official Telegram Bot API documentation `_ +there are three ways to send files (photos, stickers, audio, media, etc.): + +If the file is already stored somewhere on the Telegram servers or file is available by the URL, +you don't need to reupload it. + +But if you need to upload new file just use subclasses of `InputFile `__. + +Here is available three different builtin types of input file: + +- :obj:`FSInputFile` - `uploading from file system <#upload-from-file-system>`__ +- :obj:`BufferedInputFile` - `uploading from buffer <#upload-from-buffer>`__ +- :obj:`URLInputFile` - `uploading from URL <#upload-from-url>`__ + +.. warning:: + + **Be respectful with Telegram** + + Instances of `InputFile` is reusable. + That's mean you can create instance of InputFile and sent this file multiple times but Telegram + is not recommend to do that and when you upload file once just save their `file_id` + and use it in next times. + +Upload from file system +======================= + +By first step you will need to import InputFile wrapper: + +.. code-block:: + + from aiogram.types import FSInputFile + +Then you can use it: + +.. code-block:: + + cat = FSInputFile("cat.png") + agenda = FSInputFile("my-document.pdf", filename="agenda-2019-11-19.pdf") + + +.. autoclass:: aiogram.api.types.input_file.FSInputFile + :members: + + +Upload from buffer +================== + +Files can be also passed from buffer +(For example you generate image using `Pillow `_ +and the want's to sent it to the Telegram): + +Import wrapper: + +.. code-block:: + + from aiogram.types import BufferedInputFile + +And then you can use it: + +.. code-block:: + + text_file = BufferedInputFile(b"Hello, world!", filename="file.txt") + +.. autoclass:: aiogram.api.types.input_file.BufferedInputFile + :members: + +Upload from url +=============== + +If you need to upload a file from another server, but the direct link is bound to your server's IP, +or you want to bypass native `upload limits `_ +by URL, you can use :obj:`URLInputFile`. + +Import wrapper: + +.. code-block:: + + from aiogram.types import URLInputFile + +And then you can use it: + +.. code-block:: + + image = URLInputFile( + "https://www.python.org/static/community_logos/python-powered-h-140x182.png", + filename="python-logo.png" + ) + +.. autoclass:: aiogram.api.types.input_file.URLInputFile + :members: diff --git a/docs2/source/conf.py b/docs2/source/conf.py new file mode 100644 index 00000000..1f7a4af6 --- /dev/null +++ b/docs2/source/conf.py @@ -0,0 +1,63 @@ +import datetime + +import aiogram + +project = "aiogram" +author = "aiogram Team" +copyright = f"{datetime.date.today().year}, {author}" +release = aiogram.__version__ +api_version = aiogram.__api_version__ + +templates_path = ["_templates"] +html_theme = "sphinx_rtd_theme" +html_icon = "_static/logo.png" +html_static_path = ["_static"] +todo_include_todos = True +# pygments_style = "sphinx" +htmlhelp_basename = project +html_theme_options = { + 'collapse_navigation': False, +} + +extensions = [ + "sphinx_rtd_theme", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.autodoc", + "sphinx.ext.ifconfig", + "sphinx-prompt", + "sphinx_substitution_extensions", +] + +rst_prolog = f""" +.. |api_version| replace:: {aiogram.__api_version__} +""" + +language = None +locale_dirs = ["locales"] + +exclude_patterns = [] +source_suffix = ".rst" +master_doc = "index" + +latex_documents = [ + (master_doc, f"{project}.tex", f"{project} Documentation", author, "manual"), +] +man_pages = [(master_doc, project, f"{project} Documentation", [author], 1)] +texinfo_documents = [ + ( + master_doc, + project, + f"{project} Documentation", + author, + project, + "Modern and fully asynchronous framework for Telegram Bot API", + "Miscellaneous", + ), +] + +autodoc_default_options = { + 'member-order': 'bysource', + 'special-members': '__init__', + 'undoc-members': True, +} diff --git a/docs2/source/index.rst b/docs2/source/index.rst new file mode 100644 index 00000000..2821c9b0 --- /dev/null +++ b/docs2/source/index.rst @@ -0,0 +1,82 @@ +####### +aiogram +####### + +.. danger:: + This version still in development! + +.. image:: https://img.shields.io/pypi/l/aiogram.svg + :target: https://opensource.org/licenses/MIT + :alt: MIT License + +.. image:: https://img.shields.io/pypi/pyversions/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: Supported python versions + +.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.9-blue.svg?logo=telegram + :target: https://core.telegram.org/bots/api + :alt: Telegram Bot API + +.. image:: https://github.com/aiogram/aiogram/workflows/Tests/badge.svg?branch=dev-3.x + :target: https://github.com/aiogram/aiogram/actions + :alt: Tests + +.. image:: https://img.shields.io/pypi/v/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: PyPi Package Version + +.. image:: https://img.shields.io/pypi/status/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: PyPi status + +.. image:: https://img.shields.io/pypi/dm/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: Downloads + +.. image:: https://img.shields.io/badge/telegram-aiogram-blue.svg + :target: https://t.me/aiogram_live + :alt: [Telegram] aiogram live + + +**aiogram** modern and fully asynchronous framework for +`Telegram Bot API `_ written in Python 3.7 with +`asyncio `_ and +`aiohttp `_. + +It helps you to make your bots faster and simpler. + +Features +======== + +- Asynchronous (`asyncio docs `_, :pep:`492`) +- Has type hints (:pep:`484`) and can be used with `mypy `_ +- Supports `Telegram Bot API `_ |api_version| +- Telegram Bot API integration code was `autogenerated `_ and can be easy re-generated when API was updated +- Updates router (Blueprints) +- Finite State Machine +- Middlewares +- Provides `Replies into Webhook `_ + +.. warning:: + + Before start using **aiogram** is highly recommend to know how to work + with `asyncio `_. + + Also if you has questions you can go to our community chats in Telegram: + + - `English language `_ + - `Russian language `_ + +Simple usage +------------ + +.. literalinclude:: ../../examples/echo_bot.py + +Contents +======== + +.. toctree:: + :maxdepth: 3 + + install + api/index diff --git a/docs2/source/install.rst b/docs2/source/install.rst new file mode 100644 index 00000000..d6ea8c79 --- /dev/null +++ b/docs2/source/install.rst @@ -0,0 +1,54 @@ +############ +Installation +############ + +Stable (2.x) +============ + +Using PIP +--------- + +.. code-block:: bash + + pip install -U aiogram + + +Using poetry +------------ + +.. code-block:: bash + + poetry add aiogram + + +Using Pipenv +------------ + +.. code-block:: bash + + pipenv install aiogram + +Using AUR +--------- +*aiogram* is also available in Arch User Repository, so you can install this framework on any +Arch-based distribution like ArchLinux, Antergos, Manjaro, etc. To do this, use your favorite +AUR-helper and install `python-aiogram `_ package. + + +Development build (3.x) +======================= + +From private PyPi index +----------------------- + +On every push to the `dev-3.x` branch GitHub Actions build the package and publish +to the `2038.host `_ server with seems like official PyPi files structure. +That's mean you can always install latest (may be unstable) build via next command: + +.. code-block:: bash + + pip install --extra-index-url https://dev-docs.aiogram.dev/simple --pre aiogram + + +In this repository available only last success build. All previous builds is always removes +before uploading new one. Also before building this package all tests is also pass. diff --git a/examples/echo_bot.py b/examples/echo_bot.py new file mode 100644 index 00000000..2ab06c78 --- /dev/null +++ b/examples/echo_bot.py @@ -0,0 +1,41 @@ +from typing import Any + +from aiogram import Bot, Dispatcher, types +from aiogram.dispatcher.handler import MessageHandler + +TOKEN = "42:TOKEN" +dp = Dispatcher() + + +@dp.message(commands=["start"]) +class MyHandler(MessageHandler): + """ + This handler receive messages with `/start` command + + Usage of Class-based handlers + """ + + async def handle(self) -> Any: + await self.event.answer(f"Hello, {self.from_user.full_name}!") + + +@dp.message(content_types=[types.ContentType.ANY]) +async def echo_handler(message: types.Message, bot: Bot) -> Any: + """ + Handler will forward received message back to the sender + + Usage of Function-based handlers + """ + + await bot.forward_message( + from_chat_id=message.chat.id, chat_id=message.chat.id, message_id=message.message_id + ) + + +def main() -> None: + bot = Bot(TOKEN, parse_mode="HTML") + dp.run_polling(bot) + + +if __name__ == "__main__": + main() diff --git a/poetry.lock b/poetry.lock index d81c8b2f..13c78b31 100644 --- a/poetry.lock +++ b/poetry.lock @@ -36,6 +36,14 @@ version = "0.3.9" aiohttp = ">=2.3.2" attrs = ">=19.2.0" +[[package]] +category = "dev" +description = "A configurable sidebar-enabled Sphinx theme" +name = "alabaster" +optional = false +python-versions = "*" +version = "0.7.12" + [[package]] category = "dev" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." @@ -308,6 +316,14 @@ optional = false python-versions = "*" version = "0.3.0" +[[package]] +category = "dev" +description = "Docutils -- Python Documentation Utilities" +name = "docutils" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.16" + [[package]] category = "dev" description = "A platform independent file lock." @@ -393,6 +409,14 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "2.9" +[[package]] +category = "dev" +description = "Getting image size from png/jpeg/jpeg2000/gif file" +name = "imagesize" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.2.0" + [[package]] category = "dev" description = "Read metadata from Python packages" @@ -1246,6 +1270,157 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" version = "1.15.0" +[[package]] +category = "dev" +description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms." +name = "snowballstemmer" +optional = false +python-versions = "*" +version = "2.0.0" + +[[package]] +category = "dev" +description = "Python documentation generator" +name = "sphinx" +optional = false +python-versions = ">=3.5" +version = "3.1.0" + +[package.dependencies] +Jinja2 = ">=2.3" +Pygments = ">=2.0" +alabaster = ">=0.7,<0.8" +babel = ">=1.3" +colorama = ">=0.3.5" +docutils = ">=0.12" +imagesize = "*" +packaging = "*" +requests = ">=2.5.0" +setuptools = "*" +snowballstemmer = ">=1.1" +sphinxcontrib-applehelp = "*" +sphinxcontrib-devhelp = "*" +sphinxcontrib-htmlhelp = "*" +sphinxcontrib-jsmath = "*" +sphinxcontrib-qthelp = "*" +sphinxcontrib-serializinghtml = "*" + +[package.extras] +docs = ["sphinxcontrib-websupport"] +lint = ["flake8 (>=3.5.0)", "flake8-import-order", "mypy (>=0.780)", "docutils-stubs"] +test = ["pytest", "pytest-cov", "html5lib", "typed-ast", "cython"] + +[[package]] +category = "dev" +description = "Sphinx utility that make it easy to translate and to apply translation." +name = "sphinx-intl" +optional = false +python-versions = ">=3.5" +version = "2.0.1" + +[package.dependencies] +babel = "*" +click = "*" +setuptools = "*" +sphinx = "*" + +[package.extras] +test = ["pytest", "mock"] +transifex = ["transifex_client (>=0.11)"] + +[[package]] +category = "dev" +description = "Live preview your Sphinx documentation" +name = "sphinx-reload" +optional = false +python-versions = "*" +version = "0.2.0" + +[package.dependencies] +livereload = ">=2.5.1" + +[[package]] +category = "dev" +description = "Read the Docs theme for Sphinx" +name = "sphinx-rtd-theme" +optional = false +python-versions = "*" +version = "0.4.3" + +[package.dependencies] +sphinx = "*" + +[[package]] +category = "dev" +description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books" +name = "sphinxcontrib-applehelp" +optional = false +python-versions = ">=3.5" +version = "1.0.2" + +[package.extras] +lint = ["flake8", "mypy", "docutils-stubs"] +test = ["pytest"] + +[[package]] +category = "dev" +description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document." +name = "sphinxcontrib-devhelp" +optional = false +python-versions = ">=3.5" +version = "1.0.2" + +[package.extras] +lint = ["flake8", "mypy", "docutils-stubs"] +test = ["pytest"] + +[[package]] +category = "dev" +description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" +name = "sphinxcontrib-htmlhelp" +optional = false +python-versions = ">=3.5" +version = "1.0.3" + +[package.extras] +lint = ["flake8", "mypy", "docutils-stubs"] +test = ["pytest", "html5lib"] + +[[package]] +category = "dev" +description = "A sphinx extension which renders display math in HTML via JavaScript" +name = "sphinxcontrib-jsmath" +optional = false +python-versions = ">=3.5" +version = "1.0.1" + +[package.extras] +test = ["pytest", "flake8", "mypy"] + +[[package]] +category = "dev" +description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document." +name = "sphinxcontrib-qthelp" +optional = false +python-versions = ">=3.5" +version = "1.0.3" + +[package.extras] +lint = ["flake8", "mypy", "docutils-stubs"] +test = ["pytest"] + +[[package]] +category = "dev" +description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)." +name = "sphinxcontrib-serializinghtml" +optional = false +python-versions = ">=3.5" +version = "1.1.4" + +[package.extras] +lint = ["flake8", "mypy", "docutils-stubs"] +test = ["pytest"] + [[package]] category = "dev" description = "Python Library for Tom's Obvious, Minimal Language" @@ -1403,7 +1578,7 @@ fast = ["uvloop"] proxy = ["aiohttp-socks"] [metadata] -content-hash = "152bb9b155a00baadd3c8b9fa21f08af719180bddccb8ad6c3dd6548c3e71e3e" +content-hash = "ec62e66e9ee65b5cb1f3e0374c70118a4277c73291f7b6f0e5ea484b869f8d48" python-versions = "^3.7" [metadata.files] @@ -1429,6 +1604,10 @@ aiohttp-socks = [ {file = "aiohttp_socks-0.3.9-py3-none-any.whl", hash = "sha256:ccd483d7677d7ba80b7ccb738a9be27a3ad6dce4b2756509bc71c9d679d96105"}, {file = "aiohttp_socks-0.3.9.tar.gz", hash = "sha256:5e5638d0e472baa441eab7990cf19e034960cc803f259748cc359464ccb3c2d6"}, ] +alabaster = [ + {file = "alabaster-0.7.12-py2.py3-none-any.whl", hash = "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359"}, + {file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"}, +] appdirs = [ {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, @@ -1599,6 +1778,10 @@ decorator = [ distlib = [ {file = "distlib-0.3.0.zip", hash = "sha256:2e166e231a26b36d6dfe35a48c4464346620f8645ed0ace01ee31822b288de21"}, ] +docutils = [ + {file = "docutils-0.16-py2.py3-none-any.whl", hash = "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af"}, + {file = "docutils-0.16.tar.gz", hash = "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"}, +] filelock = [ {file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"}, {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, @@ -1626,6 +1809,10 @@ idna = [ {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, ] +imagesize = [ + {file = "imagesize-1.2.0-py2.py3-none-any.whl", hash = "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1"}, + {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, +] importlib-metadata = [ {file = "importlib_metadata-1.1.3-py2.py3-none-any.whl", hash = "sha256:7c7f8ac40673f507f349bef2eed21a0e5f01ddf5b2a7356a6c65eb2099b53764"}, {file = "importlib_metadata-1.1.3.tar.gz", hash = "sha256:7a99fb4084ffe6dae374961ba7a6521b79c1d07c658ab3a28aa264ee1d1b14e3"}, @@ -2023,6 +2210,50 @@ six = [ {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, ] +snowballstemmer = [ + {file = "snowballstemmer-2.0.0-py2.py3-none-any.whl", hash = "sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0"}, + {file = "snowballstemmer-2.0.0.tar.gz", hash = "sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"}, +] +sphinx = [ + {file = "Sphinx-3.1.0-py3-none-any.whl", hash = "sha256:7d3d5087e39ab5a031b75588e9859f011de70e213cd0080ccbc28079fb0786d1"}, + {file = "Sphinx-3.1.0.tar.gz", hash = "sha256:1c445320a3310baa5ccb8d957267ef4a0fc930dc1234db5098b3d7af14fbb242"}, +] +sphinx-intl = [ + {file = "sphinx-intl-2.0.1.tar.gz", hash = "sha256:b25a6ec169347909e8d983eefe2d8adecb3edc2f27760db79b965c69950638b4"}, + {file = "sphinx_intl-2.0.1-py3.8.egg", hash = "sha256:2ff97cba0e4e43249e339a3c29dd2f5b63c25ce794050aabca320ad95f5c5b55"}, +] +sphinx-reload = [ + {file = "sphinx-reload-0.2.0.tar.gz", hash = "sha256:800e07bffea6de0e4ee5f9c14ef565ba1d0343c4a516d028e978bbcaf712fa07"}, + {file = "sphinx_reload-0.2.0-py3-none-any.whl", hash = "sha256:0c184b990d4bc50cf14b2e6b6cf89ce4f88a2baa9b22e36ae4e2abcb8f3f44b6"}, +] +sphinx-rtd-theme = [ + {file = "sphinx_rtd_theme-0.4.3-py2.py3-none-any.whl", hash = "sha256:00cf895504a7895ee433807c62094cf1e95f065843bf3acd17037c3e9a2becd4"}, + {file = "sphinx_rtd_theme-0.4.3.tar.gz", hash = "sha256:728607e34d60456d736cc7991fd236afb828b21b82f956c5ea75f94c8414040a"}, +] +sphinxcontrib-applehelp = [ + {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, + {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"}, +] +sphinxcontrib-devhelp = [ + {file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"}, + {file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"}, +] +sphinxcontrib-htmlhelp = [ + {file = "sphinxcontrib-htmlhelp-1.0.3.tar.gz", hash = "sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b"}, + {file = "sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f"}, +] +sphinxcontrib-jsmath = [ + {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"}, + {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, +] +sphinxcontrib-qthelp = [ + {file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"}, + {file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"}, +] +sphinxcontrib-serializinghtml = [ + {file = "sphinxcontrib-serializinghtml-1.1.4.tar.gz", hash = "sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc"}, + {file = "sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl", hash = "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"}, +] toml = [ {file = "toml-0.10.1-py2.py3-none-any.whl", hash = "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"}, {file = "toml-0.10.1.tar.gz", hash = "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f"}, diff --git a/pyproject.toml b/pyproject.toml index 22efdce3..07d2a470 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,10 @@ pre-commit = "^2.3.0" packaging = "^20.3" typing-extensions = "^3.7.4" poetry = "^1.0.5" +sphinx = "^3.1.0" +sphinx-intl = "^2.0.1" +sphinx-reload = "^0.2.0" +sphinx-rtd-theme = "^0.4.3" [tool.poetry.extras] fast = ["uvloop"]