mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Update API
This commit is contained in:
parent
5aeab63384
commit
915c84c742
363 changed files with 1510 additions and 2262 deletions
|
|
@ -330,19 +330,20 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> List[Update]:
|
||||
"""
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). An Array of `Update <https://core.telegram.org/bots/api#update>`_ objects is returned.
|
||||
**Notes**
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). An Array of :class:`aiogram.types.update.Update` objects is returned.
|
||||
|
||||
**1.** This method will not work if an outgoing webhook is set up.
|
||||
**Notes**
|
||||
|
||||
**2.** In order to avoid getting duplicate updates, recalculate *offset* after each server response.
|
||||
**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.
|
||||
|
||||
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 <https://core.telegram.org/bots/api#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 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 :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will forgotten.
|
||||
:param limit: Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
|
||||
:param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
|
||||
:param allowed_updates: 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 <https://core.telegram.org/bots/api#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 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 :class:`aiogram.types.update.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.
|
||||
"""
|
||||
|
|
@ -365,16 +366,17 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized `Update <https://core.telegram.org/bots/api#update>`_. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns *True* on success.
|
||||
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 :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`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. :code:`https://www.example.com/<token>`. 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 <https://core.telegram.org/bots/api#getupdates>`_ for as long as an outgoing webhook is set up.
|
||||
**Notes**
|
||||
|
||||
**2.** To use a self-signed certificate, you need to upload your `public key certificate <https://core.telegram.org/bots/self-signed>`_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.
|
||||
**1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.
|
||||
|
||||
**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 <https://core.telegram.org/bots/webhooks>`_.
|
||||
**2.** To use a self-signed certificate, you need to upload your `public key certificate <https://core.telegram.org/bots/self-signed>`_ 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 <https://core.telegram.org/bots/webhooks>`_.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setwebhook
|
||||
|
||||
|
|
@ -382,8 +384,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param certificate: Upload your public key certificate so that the root certificate in use can be checked. See our `self-signed guide <https://core.telegram.org/bots/self-signed>`_ for details.
|
||||
:param ip_address: The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
|
||||
:param max_connections: Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to *40*. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
|
||||
:param allowed_updates: 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 <https://core.telegram.org/bots/api#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 drop_pending_updates: Pass *True* to drop all pending updates
|
||||
: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 :class:`aiogram.types.update.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 drop_pending_updates: Pass :code:`True` to drop all pending updates
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
|
|
@ -403,11 +405,11 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to remove webhook integration if you decide to switch back to `getUpdates <https://core.telegram.org/bots/api#getupdates>`_. Returns *True* on success.
|
||||
Use this method to remove webhook integration if you decide to switch back to :class:`aiogram.methods.get_updates.GetUpdates`. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletewebhook
|
||||
|
||||
:param drop_pending_updates: Pass *True* to drop all pending updates
|
||||
:param drop_pending_updates: Pass :code:`True` to drop all pending updates
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
|
|
@ -421,7 +423,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> WebhookInfo:
|
||||
"""
|
||||
Use this method to get current webhook status. Requires no parameters. On success, returns a `WebhookInfo <https://core.telegram.org/bots/api#webhookinfo>`_ object. If the bot is using `getUpdates <https://core.telegram.org/bots/api#getupdates>`_, will return an object with the *url* field empty.
|
||||
Use this method to get current webhook status. Requires no parameters. On success, returns a :class:`aiogram.types.webhook_info.WebhookInfo` object. If the bot is using :class:`aiogram.methods.get_updates.GetUpdates`, will return an object with the *url* field empty.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getwebhookinfo
|
||||
|
||||
|
|
@ -442,7 +444,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> User:
|
||||
"""
|
||||
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a `User <https://core.telegram.org/bots/api#user>`_ object.
|
||||
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getme
|
||||
|
||||
|
|
@ -457,7 +459,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns *True* on success. Requires no parameters.
|
||||
Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns :code:`True` on success. Requires no parameters.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#logout
|
||||
|
||||
|
|
@ -472,7 +474,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns *True* on success. Requires no parameters.
|
||||
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns :code:`True` on success. Requires no parameters.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#close
|
||||
|
||||
|
|
@ -499,7 +501,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send text messages. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendmessage
|
||||
|
||||
|
|
@ -510,7 +512,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param disable_web_page_preview: Disables link previews for links in this message
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -537,7 +539,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to forward messages of any kind. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to forward messages of any kind. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#forwardmessage
|
||||
|
||||
|
|
@ -573,7 +575,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> MessageId:
|
||||
"""
|
||||
Use this method to copy messages of any kind. The method is analogous to the method `forwardMessages <https://core.telegram.org/bots/api#forwardmessages>`_, but the copied message doesn't have a link to the original message. Returns the `MessageId <https://core.telegram.org/bots/api#messageid>`_ of the sent message on success.
|
||||
Use this method to copy messages of any kind. The method is analogous to the method :class:`aiogram.methods.forward_messages.ForwardMessages`, but the copied message doesn't have a link to the original message. Returns the :class:`aiogram.types.message_id.MessageId` of the sent message on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#copymessage
|
||||
|
||||
|
|
@ -585,7 +587,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param caption_entities: List of special entities that appear in the new caption, which can be specified instead of *parse_mode*
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, instructions to remove reply keyboard or to force a reply from the user.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns the MessageId of the sent message on success.
|
||||
|
|
@ -620,18 +622,18 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send photos. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send photos. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
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 :code:`@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. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing
|
||||
:param parse_mode: Mode for parsing entities in the photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -669,23 +671,23 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent `Message <https://core.telegram.org/bots/api#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 <https://core.telegram.org/bots/api#sendvoice>`_ method instead.
|
||||
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 :class:`aiogram.types.message.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 :class:`aiogram.methods.send_voice.SendVoice` method instead.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendaudio
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param caption: Audio caption, 0-1024 characters after entities parsing
|
||||
:param parse_mode: Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
: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://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -725,20 +727,20 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send general files. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#senddocument
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
: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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
|
||||
:param parse_mode: Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -779,23 +781,23 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as `Document <https://core.telegram.org/bots/api#document>`_). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvideo
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
: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://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
|
||||
:param parse_mode: Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param supports_streaming: Pass *True*, if the uploaded video is suitable for streaming
|
||||
:param supports_streaming: Pass :code:`True`, if the uploaded video is suitable for streaming
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -838,22 +840,22 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendanimation
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
: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://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
|
||||
:param parse_mode: Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -892,19 +894,19 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as `Audio <https://core.telegram.org/bots/api#audio>`_ or `Document <https://core.telegram.org/bots/api#document>`_). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as :class:`aiogram.types.audio.Audio` or :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvoice
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
: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 <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
|
||||
:param caption_entities: List of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param duration: Duration of the voice message in seconds
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -939,18 +941,18 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
As of `v.4.0 <https://telegram.org/blog/video-messages-and-telescope>`_, 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 <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
As of `v.4.0 <https://telegram.org/blog/video-messages-and-telescope>`_, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvideonote
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_. Sending video notes by a URL is currently unsupported
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`. 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://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -986,7 +988,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param media: A JSON-serialized array describing messages to be sent, must include 2-10 items
|
||||
:param disable_notification: Sends messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the messages are a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, an array of Messages that were sent is returned.
|
||||
"""
|
||||
|
|
@ -1017,7 +1019,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send point on the map. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendlocation
|
||||
|
||||
|
|
@ -1030,7 +1032,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -1064,7 +1066,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to `stopMessageLiveLocation <https://core.telegram.org/bots/api#stopmessagelivelocation>`_. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagelivelocation
|
||||
|
||||
|
|
@ -1103,7 +1105,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to stop updating a live location message before *live_period* expires. On success, if the message was sent by the bot, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to stop updating a live location message before *live_period* expires. On success, if the message was sent by the bot, the sent :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#stopmessagelivelocation
|
||||
|
||||
|
|
@ -1143,7 +1145,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send information about a venue. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send information about a venue. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvenue
|
||||
|
||||
|
|
@ -1153,12 +1155,12 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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”.)
|
||||
:param foursquare_type: Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)
|
||||
:param google_place_id: Google Places identifier of the venue
|
||||
:param google_place_type: Google Places type of the venue. (See `supported types <https://developers.google.com/places/web-service/supported_types>`_.)
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -1196,7 +1198,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send phone contacts. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendcontact
|
||||
|
||||
|
|
@ -1207,7 +1209,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param vcard: Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -1249,15 +1251,15 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send a native poll. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send a native poll. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendpoll
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param question: Poll question, 1-300 characters
|
||||
:param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters 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 is_anonymous: True, if the poll needs to be anonymous, defaults to :code:`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*
|
||||
:param correct_option_id: 0-based identifier of the correct answer option, required for 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
|
||||
|
|
@ -1265,10 +1267,10 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param explanation_entities: List of special entities that appear in the poll explanation, which can be specified instead of *parse_mode*
|
||||
: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*.
|
||||
: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*.
|
||||
:param is_closed: Pass *True*, if the poll needs to be immediately closed. This can be useful for poll preview.
|
||||
:param is_closed: Pass :code:`True`, if the poll needs to be immediately closed. This can be useful for poll preview.
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -1307,15 +1309,15 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send an animated emoji that will display a random value. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send an animated emoji that will display a random value. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
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 :code:`@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 “”, values 1-5 for “” and “”, and values 1-64 for “”. Defaults to “”
|
||||
: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 '', values 1-5 for '' and '', and values 1-64 for ''. Defaults to ''
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -1337,8 +1339,9 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns *True* on success.
|
||||
Example: The `ImageBot <https://t.me/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 <https://core.telegram.org/bots/api#sendchataction>`_ with *action* = *upload_photo*. The user will see a “sending photo” status for the bot.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Example: The `ImageBot <https://t.me/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 :class:`aiogram.methods.send_chat_action.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.
|
||||
|
||||
|
|
@ -1363,7 +1366,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> UserProfilePhotos:
|
||||
"""
|
||||
Use this method to get a list of profile pictures for a user. Returns a `UserProfilePhotos <https://core.telegram.org/bots/api#userprofilephotos>`_ object.
|
||||
Use this method to get a list of profile pictures for a user. Returns a :class:`aiogram.types.user_profile_photos.UserProfilePhotos` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
|
||||
|
|
@ -1386,7 +1389,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> File:
|
||||
"""
|
||||
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a `File <https://core.telegram.org/bots/api#file>`_ object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`, where :code:`<file_path>` 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 <https://core.telegram.org/bots/api#getfile>`_ again.
|
||||
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 :class:`aiogram.types.file.File` object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`, where :code:`<file_path>` 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 :class:`aiogram.methods.get_file.GetFile` again.
|
||||
**Note:** This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getfile
|
||||
|
|
@ -1408,7 +1411,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#kickchatmember
|
||||
|
||||
|
|
@ -1434,7 +1437,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only_if_banned*. Returns *True* on success.
|
||||
Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only_if_banned*. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unbanchatmember
|
||||
|
||||
|
|
@ -1461,7 +1464,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass *True* for all permissions to lift restrictions from a user. Returns *True* on success.
|
||||
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#restrictchatmember
|
||||
|
||||
|
|
@ -1496,13 +1499,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass *False* for all boolean parameters to demote a user. Returns *True* on success.
|
||||
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass *False* for all boolean parameters to demote a user. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#promotechatmember
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param user_id: Unique identifier of the target user
|
||||
:param is_anonymous: Pass *True*, if the administrator's presence in the chat is hidden
|
||||
:param is_anonymous: Pass :code:`True`, if the administrator's presence in the chat is hidden
|
||||
:param can_change_info: Pass True, if the administrator can change chat title, photo and other settings
|
||||
:param can_post_messages: Pass True, if the administrator can create channel posts, channels only
|
||||
:param can_edit_messages: Pass True, if the administrator can edit messages of other users and can pin messages, channels only
|
||||
|
|
@ -1537,7 +1540,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns *True* on success.
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
|
||||
|
|
@ -1561,7 +1564,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* admin rights. Returns *True* on success.
|
||||
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatpermissions
|
||||
|
||||
|
|
@ -1583,7 +1586,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
) -> str:
|
||||
"""
|
||||
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as *String* on success.
|
||||
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using `exportChatInviteLink <https://core.telegram.org/bots/api#exportchatinvitelink>`_ — after this the link will become available to the bot via the `getChat <https://core.telegram.org/bots/api#getchat>`_ method. If your bot needs to generate a new invite link replacing its previous one, use `exportChatInviteLink <https://core.telegram.org/bots/api#exportchatinvitelink>`_ again.
|
||||
|
||||
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` — after this the link will become available to the bot via the :class:`aiogram.methods.get_chat.GetChat` method. If your bot needs to generate a new invite link replacing its previous one, use :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` again.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
|
||||
|
|
@ -1603,7 +1607,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatphoto
|
||||
|
||||
|
|
@ -1624,7 +1628,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletechatphoto
|
||||
|
||||
|
|
@ -1644,7 +1648,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchattitle
|
||||
|
||||
|
|
@ -1666,7 +1670,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatdescription
|
||||
|
||||
|
|
@ -1689,13 +1693,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#pinchatmessage
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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 and private chats.
|
||||
:param disable_notification: Pass :code:`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 and private chats.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
|
|
@ -1713,7 +1717,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinchatmessage
|
||||
|
||||
|
|
@ -1734,7 +1738,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
|
||||
|
|
@ -1753,7 +1757,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method for your bot to leave a group, supergroup or channel. Returns *True* on success.
|
||||
Use this method for your bot to leave a group, supergroup or channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#leavechat
|
||||
|
||||
|
|
@ -1772,7 +1776,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Chat:
|
||||
"""
|
||||
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a `Chat <https://core.telegram.org/bots/api#chat>`_ object on success.
|
||||
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a :class:`aiogram.types.chat.Chat` object on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchat
|
||||
|
||||
|
|
@ -1791,7 +1795,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> List[ChatMember]:
|
||||
"""
|
||||
Use this method to get a list of administrators in a chat. On success, returns an Array of `ChatMember <https://core.telegram.org/bots/api#chatmember>`_ objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
|
||||
Use this method to get a list of administrators in a chat. On success, returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatadministrators
|
||||
|
||||
|
|
@ -1833,7 +1837,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> ChatMember:
|
||||
"""
|
||||
Use this method to get information about a member of a chat. Returns a `ChatMember <https://core.telegram.org/bots/api#chatmember>`_ object on success.
|
||||
Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatmember
|
||||
|
||||
|
|
@ -1855,7 +1859,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in `getChat <https://core.telegram.org/bots/api#getchat>`_ requests to check if the bot can use this method. Returns *True* on success.
|
||||
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatstickerset
|
||||
|
||||
|
|
@ -1877,7 +1881,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in `getChat <https://core.telegram.org/bots/api#getchat>`_ requests to check if the bot can use this method. Returns *True* on success.
|
||||
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletechatstickerset
|
||||
|
||||
|
|
@ -1901,15 +1905,16 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to send answers to callback queries sent from `inline keyboards <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. 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 <https://t.me/botfather>`_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter.
|
||||
Use this method to send answers to callback queries sent from `inline keyboards <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, :code:`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 <https://t.me/botfather>`_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answercallbackquery
|
||||
|
||||
:param callback_query_id: Unique identifier for the query to be answered
|
||||
:param text: Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
|
||||
:param show_alert: If *true*, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*.
|
||||
:param url: URL that will be opened by the user's client. If you have created a `Game <https://core.telegram.org/bots/api#game>`_ and accepted the conditions via `@Botfather <https://t.me/botfather>`_, specify the URL that opens your game — note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_*callback_game* button.
|
||||
:param url: URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@Botfather <https://t.me/botfather>`_, specify the URL that opens your game — note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button.
|
||||
: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.
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, True is returned.
|
||||
|
|
@ -1929,7 +1934,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to change the list of the bot's commands. Returns *True* on success.
|
||||
Use this method to change the list of the bot's commands. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmycommands
|
||||
|
||||
|
|
@ -1947,7 +1952,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> List[BotCommand]:
|
||||
"""
|
||||
Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of `BotCommand <https://core.telegram.org/bots/api#botcommand>`_ on success.
|
||||
Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of :class:`aiogram.types.bot_command.BotCommand` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getmycommands
|
||||
|
||||
|
|
@ -1975,7 +1980,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagetext
|
||||
|
||||
|
|
@ -2015,7 +2020,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagecaption
|
||||
|
||||
|
|
@ -2051,7 +2056,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagemedia
|
||||
|
||||
|
|
@ -2082,7 +2087,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagereplymarkup
|
||||
|
||||
|
|
@ -2110,7 +2115,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Poll:
|
||||
"""
|
||||
Use this method to stop a poll which was sent by the bot. On success, the stopped `Poll <https://core.telegram.org/bots/api#poll>`_ with the final results is returned.
|
||||
Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` with the final results is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#stoppoll
|
||||
|
||||
|
|
@ -2150,7 +2155,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
- 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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletemessage
|
||||
|
||||
|
|
@ -2183,15 +2188,15 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send static .WEBP or `animated <https://telegram.org/blog/animated-stickers>`_ .TGS stickers. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send static .WEBP or `animated <https://telegram.org/blog/animated-stickers>`_ .TGS stickers. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendsticker
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_, `custom reply keyboard <https://core.telegram.org/bots#keyboards>`_, 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.
|
||||
|
|
@ -2212,7 +2217,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> StickerSet:
|
||||
"""
|
||||
Use this method to get a sticker set. On success, a `StickerSet <https://core.telegram.org/bots/api#stickerset>`_ object is returned.
|
||||
Use this method to get a sticker set. On success, a :class:`aiogram.types.sticker_set.StickerSet` object is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getstickerset
|
||||
|
||||
|
|
@ -2232,12 +2237,12 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> File:
|
||||
"""
|
||||
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded `File <https://core.telegram.org/bots/api#file>`_ on success.
|
||||
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded :class:`aiogram.types.file.File` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#uploadstickerfile
|
||||
|
||||
: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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns the uploaded File on success.
|
||||
"""
|
||||
|
|
@ -2260,17 +2265,17 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
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.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#createnewstickerset
|
||||
|
||||
:param user_id: User identifier of created sticker set owner
|
||||
:param name: Short name of sticker set, to be used in :code:`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_<bot username>”*. *<bot_username>* is case insensitive. 1-64 characters.
|
||||
:param name: Short name of sticker set, to be used in :code:`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_<bot username>'*. *<bot_username>* 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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param tgs_sticker: **TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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 contains_masks: Pass :code:`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
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
|
|
@ -2298,14 +2303,14 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
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.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#addstickertoset
|
||||
|
||||
:param user_id: User identifier of sticker set owner
|
||||
: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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_
|
||||
: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. :ref:`More info on Sending Files » <sending-files>`
|
||||
:param tgs_sticker: **TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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
|
||||
:param request_timeout: Request timeout
|
||||
|
|
@ -2328,7 +2333,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to move a sticker in a set created by the bot to a specific position. Returns *True* on success.
|
||||
Use this method to move a sticker in a set created by the bot to a specific position. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setstickerpositioninset
|
||||
|
||||
|
|
@ -2349,7 +2354,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to delete a sticker from a set created by the bot. Returns *True* on success.
|
||||
Use this method to delete a sticker from a set created by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletestickerfromset
|
||||
|
||||
|
|
@ -2370,13 +2375,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
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.
|
||||
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setstickersetthumb
|
||||
|
||||
: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 <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_. Animated sticker set thumbnail can't be uploaded via HTTP URL.
|
||||
: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 <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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. :ref:`More info on Sending Files » <sending-files>`. Animated sticker set thumbnail can't be uploaded via HTTP URL.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
|
|
@ -2404,7 +2409,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to send answers to an inline query. On success, *True* is returned.
|
||||
Use this method to send answers to an inline query. On success, :code:`True` is returned.
|
||||
|
||||
No more than **50** results per query are allowed.
|
||||
|
||||
|
|
@ -2413,7 +2418,7 @@ 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.
|
||||
:param is_personal: Pass *True*, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
|
||||
:param is_personal: Pass :code:`True`, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
|
||||
:param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
|
||||
:param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*
|
||||
:param switch_pm_parameter: `Deep-linking <https://core.telegram.org/bots#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.
|
||||
|
|
@ -2465,7 +2470,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send invoices. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendinvoice
|
||||
|
||||
|
|
@ -2482,16 +2487,16 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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
|
||||
:param need_email: Pass *True*, if you require the user's email address to complete the order
|
||||
:param need_shipping_address: Pass *True*, if you require the user's shipping address to complete the order
|
||||
:param send_phone_number_to_provider: Pass *True*, if user's phone number should be sent to provider
|
||||
:param send_email_to_provider: Pass *True*, if user's email address should be sent to provider
|
||||
:param is_flexible: Pass *True*, if the final price depends on the shipping method
|
||||
:param need_name: Pass :code:`True`, if you require the user's full name to complete the order
|
||||
:param need_phone_number: Pass :code:`True`, if you require the user's phone number to complete the order
|
||||
:param need_email: Pass :code:`True`, if you require the user's email address to complete the order
|
||||
:param need_shipping_address: Pass :code:`True`, if you require the user's shipping address to complete the order
|
||||
:param send_phone_number_to_provider: Pass :code:`True`, if user's phone number should be sent to provider
|
||||
:param send_email_to_provider: Pass :code:`True`, if user's email address should be sent to provider
|
||||
:param is_flexible: Pass :code:`True`, if the final price depends on the shipping method
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. If empty, one 'Pay :code:`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.
|
||||
|
|
@ -2533,7 +2538,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an `Update <https://core.telegram.org/bots/api#update>`_ with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
||||
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answershippingquery
|
||||
|
||||
|
|
@ -2560,12 +2565,12 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an `Update <https://core.telegram.org/bots/api#update>`_ with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, True is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
|
||||
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, True is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answerprecheckoutquery
|
||||
|
||||
:param pre_checkout_query_id: Unique identifier for the query to be answered
|
||||
:param ok: Specify *True* if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use *False* if there are any problems.
|
||||
:param ok: Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use *False* if there are any problems.
|
||||
:param error_message: Required if *ok* is *False*. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, True is returned.
|
||||
|
|
@ -2589,7 +2594,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns *True* on success.
|
||||
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 :code:`True` on success.
|
||||
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setpassportdataerrors
|
||||
|
|
@ -2623,7 +2628,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send a game. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendgame
|
||||
|
||||
|
|
@ -2631,7 +2636,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via `Botfather <https://t.me/botfather>`_.
|
||||
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:param allow_sending_without_reply: Pass *True*, if the message should be sent even if the specified replied-to message is not found
|
||||
:param allow_sending_without_reply: Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found
|
||||
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. If empty, one 'Play 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.
|
||||
|
|
@ -2658,7 +2663,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> Union[Message, bool]:
|
||||
"""
|
||||
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited `Message <https://core.telegram.org/bots/api#message>`_, otherwise returns *True*. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is *False*.
|
||||
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited :class:`aiogram.types.message.Message`, otherwise returns :code:`True`. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is *False*.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setgamescore
|
||||
|
||||
|
|
@ -2694,8 +2699,9 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> List[GameHighScore]:
|
||||
"""
|
||||
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 <https://core.telegram.org/bots/api#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.
|
||||
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 :class:`aiogram.types.game_high_score.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.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getgamehighscores
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def _retrieve_basic(basic: _ProxyBasic) -> Dict[str, Any]:
|
|||
|
||||
|
||||
def _prepare_connector(chain_or_plain: _ProxyType) -> Tuple[Type["TCPConnector"], Dict[str, Any]]:
|
||||
from aiohttp_socks import ProxyInfo, ProxyConnector, ChainProxyConnector # type: ignore
|
||||
from aiohttp_socks import ChainProxyConnector, ProxyConnector, ProxyInfo # type: ignore
|
||||
|
||||
# since tuple is Iterable(compatible with _ProxyChain) object, we assume that
|
||||
# user wants chained proxies if tuple is a pair of string(url) and BasicAuth
|
||||
|
|
|
|||
|
|
@ -163,7 +163,8 @@ class TelegramEventObserver:
|
|||
return wrapper
|
||||
|
||||
def middleware(
|
||||
self, middleware: Optional[MiddlewareType] = None,
|
||||
self,
|
||||
middleware: Optional[MiddlewareType] = None,
|
||||
) -> Union[Callable[[MiddlewareType], MiddlewareType], MiddlewareType]:
|
||||
"""
|
||||
Decorator for registering inner middlewares
|
||||
|
|
@ -193,7 +194,8 @@ class TelegramEventObserver:
|
|||
return wrapper(middleware)
|
||||
|
||||
def outer_middleware(
|
||||
self, middleware: Optional[MiddlewareType] = None,
|
||||
self,
|
||||
middleware: Optional[MiddlewareType] = None,
|
||||
) -> Union[Callable[[MiddlewareType], MiddlewareType], MiddlewareType]:
|
||||
"""
|
||||
Decorator for registering outer middlewares
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class AddStickerToSet(TelegramMethod[bool]):
|
||||
"""
|
||||
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.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#addstickertoset
|
||||
"""
|
||||
|
|
@ -25,7 +25,7 @@ class AddStickerToSet(TelegramMethod[bool]):
|
|||
emojis: str
|
||||
"""One or more emoji corresponding to the sticker"""
|
||||
png_sticker: Optional[Union[InputFile, str]] = None
|
||||
"""**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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""**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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
tgs_sticker: Optional[InputFile] = None
|
||||
"""**TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_ for technical requirements"""
|
||||
mask_position: Optional[MaskPosition] = None
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class AnswerCallbackQuery(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to send answers to callback queries sent from `inline keyboards <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. 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 <https://t.me/botfather>`_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter.
|
||||
Use this method to send answers to callback queries sent from `inline keyboards <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, :code:`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 <https://t.me/botfather>`_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answercallbackquery
|
||||
"""
|
||||
|
|
@ -25,7 +26,7 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
|
|||
show_alert: Optional[bool] = None
|
||||
"""If *true*, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*."""
|
||||
url: Optional[str] = None
|
||||
"""URL that will be opened by the user's client. If you have created a `Game <https://core.telegram.org/bots/api#game>`_ and accepted the conditions via `@Botfather <https://t.me/botfather>`_, specify the URL that opens your game — note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_*callback_game* button."""
|
||||
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@Botfather <https://t.me/botfather>`_, specify the URL that opens your game — note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button."""
|
||||
cache_time: Optional[int] = None
|
||||
"""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."""
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class AnswerInlineQuery(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to send answers to an inline query. On success, *True* is returned.
|
||||
Use this method to send answers to an inline query. On success, :code:`True` is returned.
|
||||
|
||||
No more than **50** results per query are allowed.
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class AnswerInlineQuery(TelegramMethod[bool]):
|
|||
cache_time: Optional[int] = None
|
||||
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
|
||||
is_personal: Optional[bool] = None
|
||||
"""Pass *True*, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query"""
|
||||
"""Pass :code:`True`, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query"""
|
||||
next_offset: Optional[str] = None
|
||||
"""Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."""
|
||||
switch_pm_text: Optional[str] = None
|
||||
|
|
@ -38,5 +38,4 @@ class AnswerInlineQuery(TelegramMethod[bool]):
|
|||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
prepare_parse_mode(bot, data["results"])
|
||||
|
||||
return Request(method="answerInlineQuery", data=data)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class AnswerPreCheckoutQuery(TelegramMethod[bool]):
|
||||
"""
|
||||
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an `Update <https://core.telegram.org/bots/api#update>`_ with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, True is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
|
||||
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, True is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answerprecheckoutquery
|
||||
"""
|
||||
|
|
@ -20,9 +20,9 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
|
|||
pre_checkout_query_id: str
|
||||
"""Unique identifier for the query to be answered"""
|
||||
ok: bool
|
||||
"""Specify *True* if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use *False* if there are any problems."""
|
||||
"""Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems."""
|
||||
error_message: Optional[str] = None
|
||||
"""Required if *ok* is *False*. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user."""
|
||||
"""Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class AnswerShippingQuery(TelegramMethod[bool]):
|
||||
"""
|
||||
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an `Update <https://core.telegram.org/bots/api#update>`_ with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
||||
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#answershippingquery
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class Close(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns *True* on success. Requires no parameters.
|
||||
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns :code:`True` on success. Requires no parameters.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#close
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class CopyMessage(TelegramMethod[MessageId]):
|
||||
"""
|
||||
Use this method to copy messages of any kind. The method is analogous to the method `forwardMessages <https://core.telegram.org/bots/api#forwardmessages>`_, but the copied message doesn't have a link to the original message. Returns the `MessageId <https://core.telegram.org/bots/api#messageid>`_ of the sent message on success.
|
||||
Use this method to copy messages of any kind. The method is analogous to the method :class:`aiogram.methods.forward_messages.ForwardMessages`, but the copied message doesn't have a link to the original message. Returns the :class:`aiogram.types.message_id.MessageId` of the sent message on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#copymessage
|
||||
"""
|
||||
|
|
@ -43,7 +43,7 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class CreateNewStickerSet(TelegramMethod[bool]):
|
||||
"""
|
||||
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.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#createnewstickerset
|
||||
"""
|
||||
|
|
@ -21,17 +21,17 @@ class CreateNewStickerSet(TelegramMethod[bool]):
|
|||
user_id: int
|
||||
"""User identifier of created sticker set owner"""
|
||||
name: str
|
||||
"""Short name of sticker set, to be used in :code:`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_<bot username>”*. *<bot_username>* is case insensitive. 1-64 characters."""
|
||||
"""Short name of sticker set, to be used in :code:`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_<bot username>'*. *<bot_username>* is case insensitive. 1-64 characters."""
|
||||
title: str
|
||||
"""Sticker set title, 1-64 characters"""
|
||||
emojis: str
|
||||
"""One or more emoji corresponding to the sticker"""
|
||||
png_sticker: Optional[Union[InputFile, str]] = None
|
||||
"""**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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""**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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
tgs_sticker: Optional[InputFile] = None
|
||||
"""**TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <https://core.telegram.org/animated_stickers#technical-requirements>`_ for technical requirements"""
|
||||
contains_masks: Optional[bool] = None
|
||||
"""Pass *True*, if a set of mask stickers should be created"""
|
||||
"""Pass :code:`True`, if a set of mask stickers should be created"""
|
||||
mask_position: Optional[MaskPosition] = None
|
||||
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class DeleteChatPhoto(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletechatphoto
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class DeleteChatStickerSet(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in `getChat <https://core.telegram.org/bots/api#getchat>`_ requests to check if the bot can use this method. Returns *True* on success.
|
||||
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletechatstickerset
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DeleteMessage(TelegramMethod[bool]):
|
|||
|
||||
- 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 :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletemessage
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class DeleteStickerFromSet(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to delete a sticker from a set created by the bot. Returns *True* on success.
|
||||
Use this method to delete a sticker from a set created by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletestickerfromset
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class DeleteWebhook(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to remove webhook integration if you decide to switch back to `getUpdates <https://core.telegram.org/bots/api#getupdates>`_. Returns *True* on success.
|
||||
Use this method to remove webhook integration if you decide to switch back to :class:`aiogram.methods.get_updates.GetUpdates`. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deletewebhook
|
||||
"""
|
||||
|
|
@ -18,7 +18,7 @@ class DeleteWebhook(TelegramMethod[bool]):
|
|||
__returning__ = bool
|
||||
|
||||
drop_pending_updates: Optional[bool] = None
|
||||
"""Pass *True* to drop all pending updates"""
|
||||
"""Pass :code:`True` to drop all pending updates"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagecaption
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to `stopMessageLiveLocation <https://core.telegram.org/bots/api#stopmessagelivelocation>`_. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagelivelocation
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagemedia
|
||||
"""
|
||||
|
|
@ -32,7 +32,6 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
|
|||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
prepare_parse_mode(bot, data["media"])
|
||||
|
||||
files: Dict[str, InputFile] = {}
|
||||
prepare_media_file(data=data, files=files)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagereplymarkup
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editmessagetext
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
class ExportChatInviteLink(TelegramMethod[str]):
|
||||
"""
|
||||
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as *String* on success.
|
||||
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using `exportChatInviteLink <https://core.telegram.org/bots/api#exportchatinvitelink>`_ — after this the link will become available to the bot via the `getChat <https://core.telegram.org/bots/api#getchat>`_ method. If your bot needs to generate a new invite link replacing its previous one, use `exportChatInviteLink <https://core.telegram.org/bots/api#exportchatinvitelink>`_ again.
|
||||
|
||||
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` — after this the link will become available to the bot via the :class:`aiogram.methods.get_chat.GetChat` method. If your bot needs to generate a new invite link replacing its previous one, use :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` again.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class ForwardMessage(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to forward messages of any kind. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to forward messages of any kind. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#forwardmessage
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetChat(TelegramMethod[Chat]):
|
||||
"""
|
||||
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a `Chat <https://core.telegram.org/bots/api#chat>`_ object on success.
|
||||
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a :class:`aiogram.types.chat.Chat` object on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchat
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
|
||||
"""
|
||||
Use this method to get a list of administrators in a chat. On success, returns an Array of `ChatMember <https://core.telegram.org/bots/api#chatmember>`_ objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
|
||||
Use this method to get a list of administrators in a chat. On success, returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatadministrators
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetChatMember(TelegramMethod[ChatMember]):
|
||||
"""
|
||||
Use this method to get information about a member of a chat. Returns a `ChatMember <https://core.telegram.org/bots/api#chatmember>`_ object on success.
|
||||
Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatmember
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetFile(TelegramMethod[File]):
|
||||
"""
|
||||
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a `File <https://core.telegram.org/bots/api#file>`_ object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`, where :code:`<file_path>` 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 <https://core.telegram.org/bots/api#getfile>`_ again.
|
||||
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 :class:`aiogram.types.file.File` object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`, where :code:`<file_path>` 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 :class:`aiogram.methods.get_file.GetFile` again.
|
||||
**Note:** This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getfile
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
|
||||
"""
|
||||
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an *Array* of `GameHighScore <https://core.telegram.org/bots/api#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.
|
||||
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 :class:`aiogram.types.game_high_score.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.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getgamehighscores
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetMe(TelegramMethod[User]):
|
||||
"""
|
||||
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a `User <https://core.telegram.org/bots/api#user>`_ object.
|
||||
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getme
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetMyCommands(TelegramMethod[List[BotCommand]]):
|
||||
"""
|
||||
Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of `BotCommand <https://core.telegram.org/bots/api#botcommand>`_ on success.
|
||||
Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of :class:`aiogram.types.bot_command.BotCommand` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getmycommands
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetStickerSet(TelegramMethod[StickerSet]):
|
||||
"""
|
||||
Use this method to get a sticker set. On success, a `StickerSet <https://core.telegram.org/bots/api#stickerset>`_ object is returned.
|
||||
Use this method to get a sticker set. On success, a :class:`aiogram.types.sticker_set.StickerSet` object is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getstickerset
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetUpdates(TelegramMethod[List[Update]]):
|
||||
"""
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). An Array of `Update <https://core.telegram.org/bots/api#update>`_ objects is returned.
|
||||
**Notes**
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). An Array of :class:`aiogram.types.update.Update` objects is returned.
|
||||
|
||||
**1.** This method will not work if an outgoing webhook is set up.
|
||||
**Notes**
|
||||
|
||||
**2.** In order to avoid getting duplicate updates, recalculate *offset* after each server response.
|
||||
**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.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getupdates
|
||||
"""
|
||||
|
|
@ -24,13 +25,13 @@ class GetUpdates(TelegramMethod[List[Update]]):
|
|||
__returning__ = List[Update]
|
||||
|
||||
offset: Optional[int] = None
|
||||
"""Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as `getUpdates <https://core.telegram.org/bots/api#getupdates>`_ is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will forgotten."""
|
||||
"""Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will forgotten."""
|
||||
limit: Optional[int] = None
|
||||
"""Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
|
||||
timeout: Optional[int] = None
|
||||
"""Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."""
|
||||
allowed_updates: Optional[List[str]] = None
|
||||
"""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 <https://core.telegram.org/bots/api#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."""
|
||||
"""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 :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
|
||||
"""
|
||||
Use this method to get a list of profile pictures for a user. Returns a `UserProfilePhotos <https://core.telegram.org/bots/api#userprofilephotos>`_ object.
|
||||
Use this method to get a list of profile pictures for a user. Returns a :class:`aiogram.types.user_profile_photos.UserProfilePhotos` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class GetWebhookInfo(TelegramMethod[WebhookInfo]):
|
||||
"""
|
||||
Use this method to get current webhook status. Requires no parameters. On success, returns a `WebhookInfo <https://core.telegram.org/bots/api#webhookinfo>`_ object. If the bot is using `getUpdates <https://core.telegram.org/bots/api#getupdates>`_, will return an object with the *url* field empty.
|
||||
Use this method to get current webhook status. Requires no parameters. On success, returns a :class:`aiogram.types.webhook_info.WebhookInfo` object. If the bot is using :class:`aiogram.methods.get_updates.GetUpdates`, will return an object with the *url* field empty.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getwebhookinfo
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class KickChatMember(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#kickchatmember
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class LeaveChat(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method for your bot to leave a group, supergroup or channel. Returns *True* on success.
|
||||
Use this method for your bot to leave a group, supergroup or channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#leavechat
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class LogOut(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns *True* on success. Requires no parameters.
|
||||
Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns :code:`True` on success. Requires no parameters.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#logout
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class PinChatMessage(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#pinchatmessage
|
||||
"""
|
||||
|
|
@ -22,7 +22,7 @@ class PinChatMessage(TelegramMethod[bool]):
|
|||
message_id: int
|
||||
"""Identifier of a message to pin"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Pass *True*, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."""
|
||||
"""Pass :code:`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 and private chats."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class PromoteChatMember(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass *False* for all boolean parameters to demote a user. Returns *True* on success.
|
||||
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass *False* for all boolean parameters to demote a user. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#promotechatmember
|
||||
"""
|
||||
|
|
@ -22,7 +22,7 @@ class PromoteChatMember(TelegramMethod[bool]):
|
|||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
is_anonymous: Optional[bool] = None
|
||||
"""Pass *True*, if the administrator's presence in the chat is hidden"""
|
||||
"""Pass :code:`True`, if the administrator's presence in the chat is hidden"""
|
||||
can_change_info: Optional[bool] = None
|
||||
"""Pass True, if the administrator can change chat title, photo and other settings"""
|
||||
can_post_messages: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class RestrictChatMember(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass *True* for all permissions to lift restrictions from a user. Returns *True* on success.
|
||||
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#restrictchatmember
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendAnimation(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendanimation
|
||||
"""
|
||||
|
|
@ -30,7 +30,7 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
animation: Union[InputFile, str]
|
||||
"""Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of sent animation in seconds"""
|
||||
width: Optional[int] = None
|
||||
|
|
@ -38,7 +38,7 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
height: Optional[int] = None
|
||||
"""Animation height"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -50,7 +50,7 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendAudio(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent `Message <https://core.telegram.org/bots/api#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 <https://core.telegram.org/bots/api#sendvoice>`_ method instead.
|
||||
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 :class:`aiogram.types.message.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 :class:`aiogram.methods.send_voice.SendVoice` method instead.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendaudio
|
||||
"""
|
||||
|
|
@ -31,7 +31,7 @@ class SendAudio(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
audio: Union[InputFile, str]
|
||||
"""Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Audio caption, 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -45,13 +45,13 @@ class SendAudio(TelegramMethod[Message]):
|
|||
title: Optional[str] = None
|
||||
"""Track name"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendChatAction(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns *True* on success.
|
||||
Example: The `ImageBot <https://t.me/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 <https://core.telegram.org/bots/api#sendchataction>`_ with *action* = *upload_photo*. The user will see a “sending photo” status for the bot.
|
||||
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 :code:`True` on success.
|
||||
|
||||
Example: The `ImageBot <https://t.me/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 :class:`aiogram.methods.send_chat_action.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.
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendContact(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send phone contacts. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendcontact
|
||||
"""
|
||||
|
|
@ -39,7 +39,7 @@ class SendContact(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendDice(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send an animated emoji that will display a random value. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send an animated emoji that will display a random value. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#senddice
|
||||
"""
|
||||
|
|
@ -27,13 +27,13 @@ class SendDice(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
emoji: Optional[str] = None
|
||||
"""Emoji on which the dice throw animation is based. Currently, must be one of “”, “”, “”, “”, or “”. Dice can have values 1-6 for “” and “”, values 1-5 for “” and “”, and values 1-64 for “”. Defaults to “”"""
|
||||
"""Emoji on which the dice throw animation is based. Currently, must be one of '', '', '', '', or ''. Dice can have values 1-6 for '' and '', values 1-5 for '' and '', and values 1-64 for ''. Defaults to ''"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendDocument(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send general files. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#senddocument
|
||||
"""
|
||||
|
|
@ -30,9 +30,9 @@ class SendDocument(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
document: Union[InputFile, str]
|
||||
"""File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -46,7 +46,7 @@ class SendDocument(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendGame(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send a game. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendgame
|
||||
"""
|
||||
|
|
@ -27,7 +27,7 @@ class SendGame(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."""
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendInvoice(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send invoices. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendinvoice
|
||||
"""
|
||||
|
|
@ -45,25 +45,25 @@ class SendInvoice(TelegramMethod[Message]):
|
|||
photo_height: Optional[int] = None
|
||||
"""Photo height"""
|
||||
need_name: Optional[bool] = None
|
||||
"""Pass *True*, if you require the user's full name to complete the order"""
|
||||
"""Pass :code:`True`, if you require the user's full name to complete the order"""
|
||||
need_phone_number: Optional[bool] = None
|
||||
"""Pass *True*, if you require the user's phone number to complete the order"""
|
||||
"""Pass :code:`True`, if you require the user's phone number to complete the order"""
|
||||
need_email: Optional[bool] = None
|
||||
"""Pass *True*, if you require the user's email address to complete the order"""
|
||||
"""Pass :code:`True`, if you require the user's email address to complete the order"""
|
||||
need_shipping_address: Optional[bool] = None
|
||||
"""Pass *True*, if you require the user's shipping address to complete the order"""
|
||||
"""Pass :code:`True`, if you require the user's shipping address to complete the order"""
|
||||
send_phone_number_to_provider: Optional[bool] = None
|
||||
"""Pass *True*, if user's phone number should be sent to provider"""
|
||||
"""Pass :code:`True`, if user's phone number should be sent to provider"""
|
||||
send_email_to_provider: Optional[bool] = None
|
||||
"""Pass *True*, if user's email address should be sent to provider"""
|
||||
"""Pass :code:`True`, if user's email address should be sent to provider"""
|
||||
is_flexible: Optional[bool] = None
|
||||
"""Pass *True*, if the final price depends on the shipping method"""
|
||||
"""Pass :code:`True`, if the final price depends on the shipping method"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button."""
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendLocation(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send point on the map. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendlocation
|
||||
"""
|
||||
|
|
@ -43,7 +43,7 @@ class SendLocation(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the messages are a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendMessage(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send text messages. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendmessage
|
||||
"""
|
||||
|
|
@ -41,7 +41,7 @@ class SendMessage(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendPhoto(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send photos. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send photos. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendphoto
|
||||
"""
|
||||
|
|
@ -30,7 +30,7 @@ class SendPhoto(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
photo: Union[InputFile, str]
|
||||
"""Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -42,7 +42,7 @@ class SendPhoto(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendPoll(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send a native poll. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send a native poll. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendpoll
|
||||
"""
|
||||
|
|
@ -34,11 +34,11 @@ class SendPoll(TelegramMethod[Message]):
|
|||
options: List[str]
|
||||
"""A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"""
|
||||
is_anonymous: Optional[bool] = None
|
||||
"""True, if the poll needs to be anonymous, defaults to *True*"""
|
||||
"""True, if the poll needs to be anonymous, defaults to :code:`True`"""
|
||||
type: Optional[str] = None
|
||||
"""Poll type, “quiz” or “regular”, defaults to “regular”"""
|
||||
"""Poll type, 'quiz' or 'regular', defaults to 'regular'"""
|
||||
allows_multiple_answers: Optional[bool] = None
|
||||
"""True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to *False*"""
|
||||
"""True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`"""
|
||||
correct_option_id: Optional[int] = None
|
||||
"""0-based identifier of the correct answer option, required for polls in quiz mode"""
|
||||
explanation: Optional[str] = None
|
||||
|
|
@ -52,13 +52,13 @@ class SendPoll(TelegramMethod[Message]):
|
|||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""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*."""
|
||||
is_closed: Optional[bool] = None
|
||||
"""Pass *True*, if the poll needs to be immediately closed. This can be useful for poll preview."""
|
||||
"""Pass :code:`True`, if the poll needs to be immediately closed. This can be useful for poll preview."""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendSticker(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send static .WEBP or `animated <https://telegram.org/blog/animated-stickers>`_ .TGS stickers. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send static .WEBP or `animated <https://telegram.org/blog/animated-stickers>`_ .TGS stickers. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendsticker
|
||||
"""
|
||||
|
|
@ -28,13 +28,13 @@ class SendSticker(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
sticker: Union[InputFile, str]
|
||||
"""Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendVenue(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send information about a venue. On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
Use this method to send information about a venue. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvenue
|
||||
"""
|
||||
|
|
@ -37,7 +37,7 @@ class SendVenue(TelegramMethod[Message]):
|
|||
foursquare_id: Optional[str] = None
|
||||
"""Foursquare identifier of the venue"""
|
||||
foursquare_type: Optional[str] = None
|
||||
"""Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)"""
|
||||
"""Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"""
|
||||
google_place_id: Optional[str] = None
|
||||
"""Google Places identifier of the venue"""
|
||||
google_place_type: Optional[str] = None
|
||||
|
|
@ -47,7 +47,7 @@ class SendVenue(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendVideo(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as `Document <https://core.telegram.org/bots/api#document>`_). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvideo
|
||||
"""
|
||||
|
|
@ -30,7 +30,7 @@ class SendVideo(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
video: Union[InputFile, str]
|
||||
"""Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of sent video in seconds"""
|
||||
width: Optional[int] = None
|
||||
|
|
@ -38,7 +38,7 @@ class SendVideo(TelegramMethod[Message]):
|
|||
height: Optional[int] = None
|
||||
"""Video height"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -46,13 +46,13 @@ class SendVideo(TelegramMethod[Message]):
|
|||
caption_entities: Optional[List[MessageEntity]] = None
|
||||
"""List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||
supports_streaming: Optional[bool] = None
|
||||
"""Pass *True*, if the uploaded video is suitable for streaming"""
|
||||
"""Pass :code:`True`, if the uploaded video is suitable for streaming"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendVideoNote(TelegramMethod[Message]):
|
||||
"""
|
||||
As of `v.4.0 <https://telegram.org/blog/video-messages-and-telescope>`_, 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 <https://core.telegram.org/bots/api#message>`_ is returned.
|
||||
As of `v.4.0 <https://telegram.org/blog/video-messages-and-telescope>`_, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvideonote
|
||||
"""
|
||||
|
|
@ -28,19 +28,19 @@ class SendVideoNote(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
video_note: Union[InputFile, str]
|
||||
"""Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_. Sending video notes by a URL is currently unsupported"""
|
||||
"""Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More info on Sending Files » <sending-files>`. Sending video notes by a URL is currently unsupported"""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of sent video in seconds"""
|
||||
length: Optional[int] = None
|
||||
"""Video width and height, i.e. diameter of the video message"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SendVoice(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as `Audio <https://core.telegram.org/bots/api#audio>`_ or `Document <https://core.telegram.org/bots/api#document>`_). On success, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as :class:`aiogram.types.audio.Audio` or :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvoice
|
||||
"""
|
||||
|
|
@ -30,7 +30,7 @@ class SendVoice(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
voice: Union[InputFile, str]
|
||||
"""Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
caption: Optional[str] = None
|
||||
"""Voice message caption, 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = UNSET
|
||||
|
|
@ -44,7 +44,7 @@ class SendVoice(TelegramMethod[Message]):
|
|||
reply_to_message_id: Optional[int] = None
|
||||
"""If the message is a reply, ID of the original message"""
|
||||
allow_sending_without_reply: Optional[bool] = None
|
||||
"""Pass *True*, if the message should be sent even if the specified replied-to message is not found"""
|
||||
"""Pass :code:`True`, if the message should be sent even if the specified replied-to message is not found"""
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
] = None
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatAdministratorCustomTitle(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns *True* on success.
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatDescription(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatdescription
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatPermissions(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* admin rights. Returns *True* on success.
|
||||
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatpermissions
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatPhoto(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatphoto
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatStickerSet(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in `getChat <https://core.telegram.org/bots/api#getchat>`_ requests to check if the bot can use this method. Returns *True* on success.
|
||||
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatstickerset
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetChatTitle(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns *True* on success.
|
||||
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchattitle
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetGameScore(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited `Message <https://core.telegram.org/bots/api#message>`_, otherwise returns *True*. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is *False*.
|
||||
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited :class:`aiogram.types.message.Message`, otherwise returns :code:`True`. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setgamescore
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetMyCommands(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to change the list of the bot's commands. Returns *True* on success.
|
||||
Use this method to change the list of the bot's commands. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmycommands
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetPassportDataErrors(TelegramMethod[bool]):
|
||||
"""
|
||||
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns *True* on success.
|
||||
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 :code:`True` on success.
|
||||
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setpassportdataerrors
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetStickerPositionInSet(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to move a sticker in a set created by the bot to a specific position. Returns *True* on success.
|
||||
Use this method to move a sticker in a set created by the bot to a specific position. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setstickerpositioninset
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetStickerSetThumb(TelegramMethod[bool]):
|
||||
"""
|
||||
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.
|
||||
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setstickersetthumb
|
||||
"""
|
||||
|
|
@ -23,7 +23,7 @@ class SetStickerSetThumb(TelegramMethod[bool]):
|
|||
user_id: int
|
||||
"""User identifier of the sticker set owner"""
|
||||
thumb: Optional[Union[InputFile, str]] = None
|
||||
"""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 <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_. Animated sticker set thumbnail can't be uploaded via HTTP URL."""
|
||||
"""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 <https://core.telegram.org/animated_stickers#technical-requirements>`_`https://core.telegram.org/animated_stickers#technical-requirements <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. :ref:`More info on Sending Files » <sending-files>`. Animated sticker set thumbnail can't be uploaded via HTTP URL."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict(exclude={"thumb"})
|
||||
|
|
|
|||
|
|
@ -11,16 +11,17 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class SetWebhook(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized `Update <https://core.telegram.org/bots/api#update>`_. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns *True* on success.
|
||||
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 :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`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. :code:`https://www.example.com/<token>`. 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 <https://core.telegram.org/bots/api#getupdates>`_ for as long as an outgoing webhook is set up.
|
||||
**Notes**
|
||||
|
||||
**2.** To use a self-signed certificate, you need to upload your `public key certificate <https://core.telegram.org/bots/self-signed>`_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.
|
||||
**1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.
|
||||
|
||||
**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 <https://core.telegram.org/bots/webhooks>`_.
|
||||
**2.** To use a self-signed certificate, you need to upload your `public key certificate <https://core.telegram.org/bots/self-signed>`_ 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 <https://core.telegram.org/bots/webhooks>`_.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setwebhook
|
||||
"""
|
||||
|
|
@ -36,9 +37,9 @@ class SetWebhook(TelegramMethod[bool]):
|
|||
max_connections: Optional[int] = None
|
||||
"""Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to *40*. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput."""
|
||||
allowed_updates: Optional[List[str]] = None
|
||||
"""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 <https://core.telegram.org/bots/api#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."""
|
||||
"""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 :class:`aiogram.types.update.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."""
|
||||
drop_pending_updates: Optional[bool] = None
|
||||
"""Pass *True* to drop all pending updates"""
|
||||
"""Pass :code:`True` to drop all pending updates"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict(exclude={"certificate"})
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||
"""
|
||||
Use this method to stop updating a live location message before *live_period* expires. On success, if the message was sent by the bot, the sent `Message <https://core.telegram.org/bots/api#message>`_ is returned, otherwise *True* is returned.
|
||||
Use this method to stop updating a live location message before *live_period* expires. On success, if the message was sent by the bot, the sent :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#stopmessagelivelocation
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class StopPoll(TelegramMethod[Poll]):
|
||||
"""
|
||||
Use this method to stop a poll which was sent by the bot. On success, the stopped `Poll <https://core.telegram.org/bots/api#poll>`_ with the final results is returned.
|
||||
Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` with the final results is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#stoppoll
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class UnbanChatMember(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only_if_banned*. Returns *True* on success.
|
||||
Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only_if_banned*. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unbanchatmember
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class UnpinAllChatMessages(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class UnpinChatMessage(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns *True* on success.
|
||||
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinchatmessage
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class UploadStickerFile(TelegramMethod[File]):
|
||||
"""
|
||||
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded `File <https://core.telegram.org/bots/api#file>`_ on success.
|
||||
Use this method to upload a .PNG file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded :class:`aiogram.types.file.File` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#uploadstickerfile
|
||||
"""
|
||||
|
|
@ -21,7 +21,7 @@ class UploadStickerFile(TelegramMethod[File]):
|
|||
user_id: int
|
||||
"""User identifier of sticker file owner"""
|
||||
png_sticker: InputFile
|
||||
"""**PNG** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. `More info on Sending Files » <https://core.telegram.org/bots/api#sending-files>`_"""
|
||||
"""**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. :ref:`More info on Sending Files » <sending-files>`"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict(exclude={"png_sticker"})
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ class Animation(TelegramObject):
|
|||
file_id: str
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
width: int
|
||||
"""Video width as defined by sender"""
|
||||
height: int
|
||||
|
|
@ -27,10 +26,10 @@ class Animation(TelegramObject):
|
|||
duration: int
|
||||
"""Duration of the video in seconds as defined by sender"""
|
||||
thumb: Optional[PhotoSize] = None
|
||||
"""Animation thumbnail as defined by sender"""
|
||||
"""*Optional*. Animation thumbnail as defined by sender"""
|
||||
file_name: Optional[str] = None
|
||||
"""Original animation filename as defined by sender"""
|
||||
"""*Optional*. Original animation filename as defined by sender"""
|
||||
mime_type: Optional[str] = None
|
||||
"""MIME type of the file as defined by sender"""
|
||||
"""*Optional*. MIME type of the file as defined by sender"""
|
||||
file_size: Optional[int] = None
|
||||
"""File size"""
|
||||
"""*Optional*. File size"""
|
||||
|
|
|
|||
|
|
@ -18,19 +18,18 @@ class Audio(TelegramObject):
|
|||
file_id: str
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
duration: int
|
||||
"""Duration of the audio in seconds as defined by sender"""
|
||||
performer: Optional[str] = None
|
||||
"""Performer of the audio as defined by sender or by audio tags"""
|
||||
"""*Optional*. Performer of the audio as defined by sender or by audio tags"""
|
||||
title: Optional[str] = None
|
||||
"""Title of the audio as defined by sender or by audio tags"""
|
||||
"""*Optional*. Title of the audio as defined by sender or by audio tags"""
|
||||
file_name: Optional[str] = None
|
||||
"""Original filename as defined by sender"""
|
||||
"""*Optional*. Original filename as defined by sender"""
|
||||
mime_type: Optional[str] = None
|
||||
"""MIME type of the file as defined by sender"""
|
||||
"""*Optional*. MIME type of the file as defined by sender"""
|
||||
file_size: Optional[int] = None
|
||||
"""File size"""
|
||||
"""*Optional*. File size"""
|
||||
thumb: Optional[PhotoSize] = None
|
||||
"""Thumbnail of the album cover to which the music file belongs"""
|
||||
"""*Optional*. Thumbnail of the album cover to which the music file belongs"""
|
||||
|
|
|
|||
|
|
@ -23,4 +23,6 @@ class MutableTelegramObject(TelegramObject):
|
|||
allow_mutation = True
|
||||
|
||||
|
||||
UNSET: Any = sentinel.UNSET # special sentinel object which used in sutuation when None might be a useful value
|
||||
UNSET: Any = (
|
||||
sentinel.UNSET
|
||||
) # special sentinel object which used in sutuation when None might be a useful value
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class BotCommand(MutableTelegramObject):
|
|||
"""
|
||||
|
||||
command: str
|
||||
"""Text of the command, 1-32 characters. Can contain only lowercase English letters, digits
|
||||
and underscores."""
|
||||
"""Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores."""
|
||||
description: str
|
||||
"""Description of the command, 3-256 characters."""
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from .base import TelegramObject
|
|||
|
||||
class CallbackGame(TelegramObject):
|
||||
"""
|
||||
A placeholder, currently holds no information. Use BotFather to set up your game.
|
||||
A placeholder, currently holds no information. Use `BotFather <https://t.me/botfather>`_ to set up your game.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#callbackgame
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,22 +7,16 @@ from pydantic import Field
|
|||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from ..methods import AnswerCallbackQuery
|
||||
from .message import Message
|
||||
from .user import User
|
||||
from ..methods import AnswerCallbackQuery
|
||||
|
||||
|
||||
class CallbackQuery(TelegramObject):
|
||||
"""
|
||||
This object represents an incoming callback query from a callback button in an inline
|
||||
keyboard. If the button that originated the query was attached to a message sent by the bot,
|
||||
the field message will be present. If the button was attached to a message sent via the bot
|
||||
(in inline mode), the field inline_message_id will be present. Exactly one of the fields data
|
||||
or game_short_name will be present.
|
||||
NOTE: After the user presses a callback button, Telegram clients will display a progress bar
|
||||
until you call answerCallbackQuery. It is, therefore, necessary to react by calling
|
||||
answerCallbackQuery even if no notification to the user is needed (e.g., without specifying
|
||||
any of the optional parameters).
|
||||
This object represents an incoming callback query from a callback button in an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_. 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 <https://core.telegram.org/bots/api#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 :class:`aiogram.methods.answer_callback_query.AnswerCallbackQuery`. It is, therefore, necessary to react by calling :class:`aiogram.methods.answer_callback_query.AnswerCallbackQuery` even if no notification to the user is needed (e.g., without specifying any of the optional parameters).
|
||||
|
||||
Source: https://core.telegram.org/bots/api#callbackquery
|
||||
"""
|
||||
|
|
@ -32,18 +26,15 @@ class CallbackQuery(TelegramObject):
|
|||
from_user: User = Field(..., alias="from")
|
||||
"""Sender"""
|
||||
chat_instance: str
|
||||
"""Global identifier, uniquely corresponding to the chat to which the message with the
|
||||
callback button was sent. Useful for high scores in games."""
|
||||
"""Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in :class:`aiogram.methods.games.Games`."""
|
||||
message: Optional[Message] = None
|
||||
"""Message with the callback button that originated the query. Note that message content and
|
||||
message date will not be available if the message is too old"""
|
||||
"""*Optional*. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old"""
|
||||
inline_message_id: Optional[str] = None
|
||||
"""Identifier of the message sent via the bot in inline mode, that originated the query."""
|
||||
"""*Optional*. Identifier of the message sent via the bot in inline mode, that originated the query."""
|
||||
data: Optional[str] = None
|
||||
"""Data associated with the callback button. Be aware that a bad client can send arbitrary
|
||||
data in this field."""
|
||||
"""*Optional*. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field."""
|
||||
game_short_name: Optional[str] = None
|
||||
"""Short name of a Game to be returned, serves as the unique identifier for the game"""
|
||||
"""*Optional*. Short name of a `Game <https://core.telegram.org/bots/api#games>`_ to be returned, serves as the unique identifier for the game"""
|
||||
|
||||
def answer(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -19,47 +19,36 @@ class Chat(TelegramObject):
|
|||
"""
|
||||
|
||||
id: int
|
||||
"""Unique identifier for this chat. This number may be greater than 32 bits and some
|
||||
programming languages may have difficulty/silent defects in interpreting it. But it is
|
||||
smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe
|
||||
for storing this identifier."""
|
||||
"""Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier."""
|
||||
type: str
|
||||
"""Type of chat, can be either 'private', 'group', 'supergroup' or 'channel'"""
|
||||
title: Optional[str] = None
|
||||
"""Title, for supergroups, channels and group chats"""
|
||||
"""*Optional*. Title, for supergroups, channels and group chats"""
|
||||
username: Optional[str] = None
|
||||
"""Username, for private chats, supergroups and channels if available"""
|
||||
"""*Optional*. Username, for private chats, supergroups and channels if available"""
|
||||
first_name: Optional[str] = None
|
||||
"""First name of the other party in a private chat"""
|
||||
"""*Optional*. First name of the other party in a private chat"""
|
||||
last_name: Optional[str] = None
|
||||
"""Last name of the other party in a private chat"""
|
||||
"""*Optional*. Last name of the other party in a private chat"""
|
||||
photo: Optional[ChatPhoto] = None
|
||||
"""Chat photo. Returned only in getChat."""
|
||||
"""*Optional*. Chat photo. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
bio: Optional[str] = None
|
||||
"""Bio of the other party in a private chat. Returned only in getChat."""
|
||||
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
description: Optional[str] = None
|
||||
"""Description, for groups, supergroups and channel chats. Returned only in getChat."""
|
||||
"""*Optional*. Description, for groups, supergroups and channel chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
invite_link: Optional[str] = None
|
||||
"""Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat
|
||||
generates their own invite links, so the bot must first generate the link using
|
||||
exportChatInviteLink. Returned only in getChat."""
|
||||
"""*Optional*. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink`. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
pinned_message: Optional[Message] = None
|
||||
"""The most recent pinned message (by sending date). Returned only in getChat."""
|
||||
"""*Optional*. The most recent pinned message (by sending date). Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
permissions: Optional[ChatPermissions] = None
|
||||
"""Default chat member permissions, for groups and supergroups. Returned only in getChat."""
|
||||
"""*Optional*. Default chat member permissions, for groups and supergroups. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
slow_mode_delay: Optional[int] = None
|
||||
"""For supergroups, the minimum allowed delay between consecutive messages sent by each
|
||||
unpriviledged user. Returned only in getChat."""
|
||||
"""*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
sticker_set_name: Optional[str] = None
|
||||
"""For supergroups, name of group sticker set. Returned only in getChat."""
|
||||
"""*Optional*. For supergroups, name of group sticker set. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
can_set_sticker_set: Optional[bool] = None
|
||||
"""True, if the bot can change the group sticker set. Returned only in getChat."""
|
||||
"""*Optional*. True, if the bot can change the group sticker set. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
linked_chat_id: Optional[int] = None
|
||||
"""Unique identifier for the linked chat, i.e. the discussion group identifier for a channel
|
||||
and vice versa; for supergroups and channel chats. This identifier may be greater than 32
|
||||
bits and some programming languages may have difficulty/silent defects in interpreting it.
|
||||
But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type
|
||||
are safe for storing this identifier. Returned only in getChat."""
|
||||
"""*Optional*. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
location: Optional[ChatLocation] = None
|
||||
"""For supergroups, the location to which the supergroup is connected. Returned only in
|
||||
getChat."""
|
||||
"""*Optional*. For supergroups, the location to which the supergroup is connected. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
|
|
|
|||
|
|
@ -21,53 +21,43 @@ class ChatMember(TelegramObject):
|
|||
user: User
|
||||
"""Information about the user"""
|
||||
status: str
|
||||
"""The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted',
|
||||
'left' or 'kicked'"""
|
||||
"""The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked'"""
|
||||
custom_title: Optional[str] = None
|
||||
"""Owner and administrators only. Custom title for this user"""
|
||||
"""*Optional*. Owner and administrators only. Custom title for this user"""
|
||||
is_anonymous: Optional[bool] = None
|
||||
"""Owner and administrators only. True, if the user's presence in the chat is hidden"""
|
||||
"""*Optional*. Owner and administrators only. True, if the user's presence in the chat is hidden"""
|
||||
can_be_edited: Optional[bool] = None
|
||||
"""Administrators only. True, if the bot is allowed to edit administrator privileges of that
|
||||
user"""
|
||||
"""*Optional*. Administrators only. True, if the bot is allowed to edit administrator privileges of that user"""
|
||||
can_post_messages: Optional[bool] = None
|
||||
"""Administrators only. True, if the administrator can post in the channel; channels only"""
|
||||
"""*Optional*. Administrators only. True, if the administrator can post in the channel; channels only"""
|
||||
can_edit_messages: Optional[bool] = None
|
||||
"""Administrators only. True, if the administrator can edit messages of other users and can
|
||||
pin messages; channels only"""
|
||||
"""*Optional*. Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only"""
|
||||
can_delete_messages: Optional[bool] = None
|
||||
"""Administrators only. True, if the administrator can delete messages of other users"""
|
||||
"""*Optional*. Administrators only. True, if the administrator can delete messages of other users"""
|
||||
can_restrict_members: Optional[bool] = None
|
||||
"""Administrators only. True, if the administrator can restrict, ban or unban chat members"""
|
||||
"""*Optional*. Administrators only. True, if the administrator can restrict, ban or unban chat members"""
|
||||
can_promote_members: Optional[bool] = None
|
||||
"""Administrators only. True, if the administrator can add new administrators with a subset of
|
||||
their own privileges or demote administrators that he has promoted, directly or indirectly
|
||||
(promoted by administrators that were appointed by the user)"""
|
||||
"""*Optional*. Administrators only. 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 the user)"""
|
||||
can_change_info: Optional[bool] = None
|
||||
"""Administrators and restricted only. True, if the user is allowed to change the chat title,
|
||||
photo and other settings"""
|
||||
"""*Optional*. Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings"""
|
||||
can_invite_users: Optional[bool] = None
|
||||
"""Administrators and restricted only. True, if the user is allowed to invite new users to the
|
||||
chat"""
|
||||
"""*Optional*. Administrators and restricted only. True, if the user is allowed to invite new users to the chat"""
|
||||
can_pin_messages: Optional[bool] = None
|
||||
"""Administrators and restricted only. True, if the user is allowed to pin messages; groups
|
||||
and supergroups only"""
|
||||
"""*Optional*. Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only"""
|
||||
is_member: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is a member of the chat at the moment of the request"""
|
||||
"""*Optional*. Restricted only. True, if the user is a member of the chat at the moment of the request"""
|
||||
can_send_messages: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is allowed to send text messages, contacts, locations
|
||||
and venues"""
|
||||
"""*Optional*. Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues"""
|
||||
can_send_media_messages: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is allowed to send audios, documents, photos, videos,
|
||||
video notes and voice notes"""
|
||||
"""*Optional*. Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes"""
|
||||
can_send_polls: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is allowed to send polls"""
|
||||
"""*Optional*. Restricted only. True, if the user is allowed to send polls"""
|
||||
can_send_other_messages: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is allowed to send animations, games, stickers and use
|
||||
inline bots"""
|
||||
"""*Optional*. Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots"""
|
||||
can_add_web_page_previews: Optional[bool] = None
|
||||
"""Restricted only. True, if the user is allowed to add web page previews to their messages"""
|
||||
"""*Optional*. Restricted only. True, if the user is allowed to add web page previews to their messages"""
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""*Optional*. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time"""
|
||||
"""Restricted and kicked only. Date when restrictions will be lifted for this user; unix time"""
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -13,22 +13,18 @@ class ChatPermissions(MutableTelegramObject):
|
|||
"""
|
||||
|
||||
can_send_messages: Optional[bool] = None
|
||||
"""True, if the user is allowed to send text messages, contacts, locations and venues"""
|
||||
"""*Optional*. True, if the user is allowed to send text messages, contacts, locations and venues"""
|
||||
can_send_media_messages: Optional[bool] = None
|
||||
"""True, if the user is allowed to send audios, documents, photos, videos, video notes and
|
||||
voice notes, implies can_send_messages"""
|
||||
"""*Optional*. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages"""
|
||||
can_send_polls: Optional[bool] = None
|
||||
"""True, if the user is allowed to send polls, implies can_send_messages"""
|
||||
"""*Optional*. True, if the user is allowed to send polls, implies can_send_messages"""
|
||||
can_send_other_messages: Optional[bool] = None
|
||||
"""True, if the user is allowed to send animations, games, stickers and use inline bots,
|
||||
implies can_send_media_messages"""
|
||||
"""*Optional*. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages"""
|
||||
can_add_web_page_previews: Optional[bool] = None
|
||||
"""True, if the user is allowed to add web page previews to their messages, implies
|
||||
can_send_media_messages"""
|
||||
"""*Optional*. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages"""
|
||||
can_change_info: Optional[bool] = None
|
||||
"""True, if the user is allowed to change the chat title, photo and other settings. Ignored in
|
||||
public supergroups"""
|
||||
"""*Optional*. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups"""
|
||||
can_invite_users: Optional[bool] = None
|
||||
"""True, if the user is allowed to invite new users to the chat"""
|
||||
"""*Optional*. True, if the user is allowed to invite new users to the chat"""
|
||||
can_pin_messages: Optional[bool] = None
|
||||
"""True, if the user is allowed to pin messages. Ignored in public supergroups"""
|
||||
"""*Optional*. True, if the user is allowed to pin messages. Ignored in public supergroups"""
|
||||
|
|
|
|||
|
|
@ -11,14 +11,10 @@ class ChatPhoto(TelegramObject):
|
|||
"""
|
||||
|
||||
small_file_id: str
|
||||
"""File identifier of small (160x160) chat photo. This file_id can be used only for photo
|
||||
download and only for as long as the photo is not changed."""
|
||||
"""File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed."""
|
||||
small_file_unique_id: str
|
||||
"""Unique file identifier of small (160x160) chat photo, which is supposed to be the same over
|
||||
time and for different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
big_file_id: str
|
||||
"""File identifier of big (640x640) chat photo. This file_id can be used only for photo
|
||||
download and only for as long as the photo is not changed."""
|
||||
"""File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed."""
|
||||
big_file_unique_id: str
|
||||
"""Unique file identifier of big (640x640) chat photo, which is supposed to be the same over
|
||||
time and for different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
|
|
|
|||
|
|
@ -13,10 +13,8 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class ChosenInlineResult(TelegramObject):
|
||||
"""
|
||||
Represents a result of an inline query that was chosen by the user and sent to their chat
|
||||
partner.
|
||||
Note: It is necessary to enable inline feedback via @Botfather in order to receive these
|
||||
objects in updates.
|
||||
Represents a `result <https://core.telegram.org/bots/api#inlinequeryresult>`_ of an inline query that was chosen by the user and sent to their chat partner.
|
||||
**Note:** It is necessary to enable `inline feedback <https://core.telegram.org/bots/inline#collecting-feedback>`_ via `@Botfather <https://t.me/botfather>`_ in order to receive these objects in updates.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#choseninlineresult
|
||||
"""
|
||||
|
|
@ -28,8 +26,6 @@ class ChosenInlineResult(TelegramObject):
|
|||
query: str
|
||||
"""The query that was used to obtain the result"""
|
||||
location: Optional[Location] = None
|
||||
"""Sender location, only for bots that require user location"""
|
||||
"""*Optional*. Sender location, only for bots that require user location"""
|
||||
inline_message_id: Optional[str] = None
|
||||
"""Identifier of the sent inline message. Available only if there is an inline keyboard
|
||||
attached to the message. Will be also received in callback queries and can be used to edit
|
||||
the message."""
|
||||
"""*Optional*. Identifier of the sent inline message. Available only if there is an `inline keyboard <https://core.telegram.org/bots/api#inlinekeyboardmarkup>`_ attached to the message. Will be also received in `callback queries <https://core.telegram.org/bots/api#callbackquery>`_ and can be used to `edit <https://core.telegram.org/bots/api#updating-messages>`_ the message."""
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class Contact(TelegramObject):
|
|||
first_name: str
|
||||
"""Contact's first name"""
|
||||
last_name: Optional[str] = None
|
||||
"""Contact's last name"""
|
||||
"""*Optional*. Contact's last name"""
|
||||
user_id: Optional[int] = None
|
||||
"""Contact's user identifier in Telegram"""
|
||||
"""*Optional*. Contact's user identifier in Telegram"""
|
||||
vcard: Optional[str] = None
|
||||
"""Additional data about the contact in the form of a vCard"""
|
||||
"""*Optional*. Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_"""
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ class Dice(TelegramObject):
|
|||
emoji: str
|
||||
"""Emoji on which the dice throw animation is based"""
|
||||
value: int
|
||||
"""Value of the dice, 1-6 for '' and '' base emoji, 1-5 for '' and '' base emoji, 1-64 for ''
|
||||
base emoji"""
|
||||
"""Value of the dice, 1-6 for '' and '' base emoji, 1-5 for '' and '' base emoji, 1-64 for '' base emoji"""
|
||||
|
||||
|
||||
class DiceEmoji:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class Document(TelegramObject):
|
||||
"""
|
||||
This object represents a general file (as opposed to photos, voice messages and audio files).
|
||||
This object represents a general file (as opposed to `photos <https://core.telegram.org/bots/api#photosize>`_, `voice messages <https://core.telegram.org/bots/api#voice>`_ and `audio files <https://core.telegram.org/bots/api#audio>`_).
|
||||
|
||||
Source: https://core.telegram.org/bots/api#document
|
||||
"""
|
||||
|
|
@ -18,13 +18,12 @@ class Document(TelegramObject):
|
|||
file_id: str
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
thumb: Optional[PhotoSize] = None
|
||||
"""Document thumbnail as defined by sender"""
|
||||
"""*Optional*. Document thumbnail as defined by sender"""
|
||||
file_name: Optional[str] = None
|
||||
"""Original filename as defined by sender"""
|
||||
"""*Optional*. Original filename as defined by sender"""
|
||||
mime_type: Optional[str] = None
|
||||
"""MIME type of the file as defined by sender"""
|
||||
"""*Optional*. MIME type of the file as defined by sender"""
|
||||
file_size: Optional[int] = None
|
||||
"""File size"""
|
||||
"""*Optional*. File size"""
|
||||
|
|
|
|||
|
|
@ -5,18 +5,14 @@ from .base import TelegramObject
|
|||
|
||||
class EncryptedCredentials(TelegramObject):
|
||||
"""
|
||||
Contains data required for decrypting and authenticating EncryptedPassportElement. See the
|
||||
Telegram Passport Documentation for a complete description of the data decryption and
|
||||
authentication processes.
|
||||
Contains data required for decrypting and authenticating :class:`aiogram.types.encrypted_passport_element.EncryptedPassportElement`. See the `Telegram Passport Documentation <https://core.telegram.org/passport#receiving-information>`_ for a complete description of the data decryption and authentication processes.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#encryptedcredentials
|
||||
"""
|
||||
|
||||
data: str
|
||||
"""Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and
|
||||
secrets required for EncryptedPassportElement decryption and authentication"""
|
||||
"""Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for :class:`aiogram.types.encrypted_passport_element.EncryptedPassportElement` decryption and authentication"""
|
||||
hash: str
|
||||
"""Base64-encoded data hash for data authentication"""
|
||||
secret: str
|
||||
"""Base64-encoded secret, encrypted with the bot's public RSA key, required for data
|
||||
decryption"""
|
||||
"""Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption"""
|
||||
|
|
|
|||
|
|
@ -10,45 +10,28 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class EncryptedPassportElement(TelegramObject):
|
||||
"""
|
||||
Contains information about documents or other Telegram Passport elements shared with the bot
|
||||
by the user.
|
||||
Contains information about documents or other Telegram Passport elements shared with the bot by the user.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#encryptedpassportelement
|
||||
"""
|
||||
|
||||
type: str
|
||||
"""Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card',
|
||||
'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement',
|
||||
'passport_registration', 'temporary_registration', 'phone_number', 'email'."""
|
||||
"""Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration', 'phone_number', 'email'."""
|
||||
hash: str
|
||||
"""Base64-encoded element hash for using in PassportElementErrorUnspecified"""
|
||||
"""Base64-encoded element hash for using in :class:`aiogram.types.passport_element_error_unspecified.PassportElementErrorUnspecified`"""
|
||||
data: Optional[str] = None
|
||||
"""Base64-encoded encrypted Telegram Passport element data provided by the user, available for
|
||||
'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and
|
||||
'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Base64-encoded encrypted Telegram Passport element data provided by the user, available for 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and 'address' types. Can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
phone_number: Optional[str] = None
|
||||
"""User's verified phone number, available only for 'phone_number' type"""
|
||||
"""*Optional*. User's verified phone number, available only for 'phone_number' type"""
|
||||
email: Optional[str] = None
|
||||
"""User's verified email address, available only for 'email' type"""
|
||||
"""*Optional*. User's verified email address, available only for 'email' type"""
|
||||
files: Optional[List[PassportFile]] = None
|
||||
"""Array of encrypted files with documents provided by the user, available for 'utility_bill',
|
||||
'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration'
|
||||
types. Files can be decrypted and verified using the accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Array of encrypted files with documents provided by the user, available for 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
front_side: Optional[PassportFile] = None
|
||||
"""Encrypted file with the front side of the document, provided by the user. Available for
|
||||
'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be
|
||||
decrypted and verified using the accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Encrypted file with the front side of the document, provided by the user. Available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
reverse_side: Optional[PassportFile] = None
|
||||
"""Encrypted file with the reverse side of the document, provided by the user. Available for
|
||||
'driver_license' and 'identity_card'. The file can be decrypted and verified using the
|
||||
accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Encrypted file with the reverse side of the document, provided by the user. Available for 'driver_license' and 'identity_card'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
selfie: Optional[PassportFile] = None
|
||||
"""Encrypted file with the selfie of the user holding a document, provided by the user;
|
||||
available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The
|
||||
file can be decrypted and verified using the accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Encrypted file with the selfie of the user holding a document, provided by the user; available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
translation: Optional[List[PassportFile]] = None
|
||||
"""Array of encrypted files with translated versions of documents provided by the user.
|
||||
Available if requested for 'passport', 'driver_license', 'identity_card',
|
||||
'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement',
|
||||
'passport_registration' and 'temporary_registration' types. Files can be decrypted and
|
||||
verified using the accompanying EncryptedCredentials."""
|
||||
"""*Optional*. Array of encrypted files with translated versions of documents provided by the user. Available if requested for 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`."""
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@ from .base import TelegramObject
|
|||
|
||||
class File(TelegramObject):
|
||||
"""
|
||||
This object represents a file ready to be downloaded. The file can be downloaded via the link
|
||||
https://api.telegram.org/file/bot<token>/<file_path>. 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
|
||||
This object represents a file ready to be downloaded. The file can be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`. 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 :class:`aiogram.methods.get_file.GetFile`.
|
||||
|
||||
Maximum file size to download is 20 MB
|
||||
|
||||
Source: https://core.telegram.org/bots/api#file
|
||||
"""
|
||||
|
|
@ -19,9 +17,8 @@ class File(TelegramObject):
|
|||
file_id: str
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."""
|
||||
file_size: Optional[int] = None
|
||||
"""File size, if known"""
|
||||
"""*Optional*. File size, if known"""
|
||||
file_path: Optional[str] = None
|
||||
"""File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file."""
|
||||
"""*Optional*. File path. Use :code:`https://api.telegram.org/file/bot<token>/<file_path>` to get the file."""
|
||||
|
|
|
|||
|
|
@ -7,29 +7,19 @@ from .base import MutableTelegramObject
|
|||
|
||||
class ForceReply(MutableTelegramObject):
|
||||
"""
|
||||
Upon receiving a message with this object, Telegram clients will display a reply interface to
|
||||
the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be
|
||||
extremely useful if you want to create user-friendly step-by-step interfaces without having to
|
||||
sacrifice privacy mode.
|
||||
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its
|
||||
messages and mentions). There could be two ways to create a new poll:
|
||||
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice `privacy mode <https://core.telegram.org/bots#privacy-mode>`_.
|
||||
|
||||
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.
|
||||
**Example:** A `poll bot <https://t.me/PollBot>`_ 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 :class:`aiogram.types.force_reply.ForceReply` in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions — without any extra work for the user.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#forcereply
|
||||
"""
|
||||
|
||||
force_reply: bool
|
||||
"""Shows reply interface to the user, as if they manually selected the bot's message and
|
||||
tapped 'Reply'"""
|
||||
"""Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'"""
|
||||
selective: Optional[bool] = None
|
||||
"""Use this parameter if you want to force reply from specific users only. Targets: 1) users
|
||||
that are @mentioned in the text of the Message object; 2) if the bot's message is a reply
|
||||
(has reply_to_message_id), sender of the original message."""
|
||||
"""*Optional*. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the *text* of the :class:`aiogram.types.message.Message` object; 2) if the bot's message is a reply (has *reply_to_message_id*), sender of the original message."""
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class Game(TelegramObject):
|
||||
"""
|
||||
This object represents a game. Use BotFather to create and edit games, their short names will
|
||||
act as unique identifiers.
|
||||
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#game
|
||||
"""
|
||||
|
|
@ -25,10 +24,8 @@ class Game(TelegramObject):
|
|||
photo: List[PhotoSize]
|
||||
"""Photo that will be displayed in the game message in chats."""
|
||||
text: Optional[str] = None
|
||||
"""Brief description of the game or high scores included in the game message. Can be
|
||||
automatically edited to include current high scores for the game when the bot calls
|
||||
setGameScore, or manually edited using editMessageText. 0-4096 characters."""
|
||||
"""*Optional*. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls :class:`aiogram.methods.set_game_score.SetGameScore`, or manually edited using :class:`aiogram.methods.edit_message_text.EditMessageText`. 0-4096 characters."""
|
||||
text_entities: Optional[List[MessageEntity]] = None
|
||||
"""Special entities that appear in text, such as usernames, URLs, bot commands, etc."""
|
||||
"""*Optional*. Special entities that appear in *text*, such as usernames, URLs, bot commands, etc."""
|
||||
animation: Optional[Animation] = None
|
||||
"""Animation that will be displayed in the game message in chats. Upload via BotFather"""
|
||||
"""*Optional*. Animation that will be displayed in the game message in chats. Upload via `BotFather <https://t.me/botfather>`_"""
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class GameHighScore(TelegramObject):
|
|||
"""
|
||||
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
|
||||
|
||||
If you've got any questions, please check out our `https://core.telegram.org/bots/faq <https://core.telegram.org/bots/faq>`_ **Bot FAQ »**
|
||||
|
||||
Source: https://core.telegram.org/bots/api#gamehighscore
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class InlineKeyboardButton(MutableTelegramObject):
|
||||
"""
|
||||
This object represents one button of an inline keyboard. You must use exactly one of the
|
||||
optional fields.
|
||||
This object represents one button of an inline keyboard. You **must** use exactly one of the optional fields.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inlinekeyboardbutton
|
||||
"""
|
||||
|
|
@ -20,21 +19,16 @@ class InlineKeyboardButton(MutableTelegramObject):
|
|||
text: str
|
||||
"""Label text on the button"""
|
||||
url: Optional[str] = None
|
||||
"""HTTP or tg:// url to be opened when button is pressed"""
|
||||
"""*Optional*. HTTP or tg:// url to be opened when button is pressed"""
|
||||
login_url: Optional[LoginUrl] = None
|
||||
"""An HTTP URL used to automatically authorize the user. Can be used as a replacement for the
|
||||
Telegram Login Widget."""
|
||||
"""*Optional*. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the `Telegram Login Widget <https://core.telegram.org/widgets/login>`_."""
|
||||
callback_data: Optional[str] = None
|
||||
"""Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes"""
|
||||
"""*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when button is pressed, 1-64 bytes"""
|
||||
switch_inline_query: Optional[str] = None
|
||||
"""If set, pressing the button will prompt the user to select one of their chats, open that
|
||||
chat and insert the bot's username and the specified inline query in the input field. Can
|
||||
be empty, in which case just the bot's username will be inserted."""
|
||||
"""*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted."""
|
||||
switch_inline_query_current_chat: Optional[str] = None
|
||||
"""If set, pressing the button will insert the bot's username and the specified inline query
|
||||
in the current chat's input field. Can be empty, in which case only the bot's username will
|
||||
be inserted."""
|
||||
"""*Optional*. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted."""
|
||||
callback_game: Optional[CallbackGame] = None
|
||||
"""Description of the game that will be launched when the user presses the button."""
|
||||
"""*Optional*. Description of the game that will be launched when the user presses the button."""
|
||||
pay: Optional[bool] = None
|
||||
"""Specify True, to send a Pay button."""
|
||||
"""*Optional*. Specify True, to send a `Pay button <https://core.telegram.org/bots/api#payments>`_."""
|
||||
|
|
|
|||
|
|
@ -10,13 +10,11 @@ if TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
class InlineKeyboardMarkup(MutableTelegramObject):
|
||||
"""
|
||||
This object represents an inline keyboard that appears right next to the message it belongs
|
||||
to.
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
|
||||
will display unsupported message.
|
||||
This object represents an `inline keyboard <https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating>`_ that appears right next to the message it belongs to.
|
||||
**Note:** This will only work in Telegram versions released after 9 April, 2016. Older clients will display *unsupported message*.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
"""
|
||||
|
||||
inline_keyboard: List[List[InlineKeyboardButton]]
|
||||
"""Array of button rows, each represented by an Array of InlineKeyboardButton objects"""
|
||||
"""Array of button rows, each represented by an Array of :class:`aiogram.types.inline_keyboard_button.InlineKeyboardButton` objects"""
|
||||
|
|
|
|||
|
|
@ -7,16 +7,15 @@ from pydantic import Field
|
|||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from ..methods import AnswerInlineQuery
|
||||
from .inline_query_result import InlineQueryResult
|
||||
from .location import Location
|
||||
from .user import User
|
||||
from .inline_query_result import InlineQueryResult
|
||||
from ..methods import AnswerInlineQuery
|
||||
|
||||
|
||||
class InlineQuery(TelegramObject):
|
||||
"""
|
||||
This object represents an incoming inline query. When the user sends an empty query, your bot
|
||||
could return some default or trending results.
|
||||
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inlinequery
|
||||
"""
|
||||
|
|
@ -30,7 +29,7 @@ class InlineQuery(TelegramObject):
|
|||
offset: str
|
||||
"""Offset of the results to be returned, can be controlled by the bot"""
|
||||
location: Optional[Location] = None
|
||||
"""Sender location, only for bots that request user location"""
|
||||
"""*Optional*. Sender location, only for bots that request user location"""
|
||||
|
||||
def answer(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -5,28 +5,28 @@ from .base import MutableTelegramObject
|
|||
|
||||
class InlineQueryResult(MutableTelegramObject):
|
||||
"""
|
||||
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
|
||||
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
|
||||
|
||||
- :class:`aiogram.types.inline_query_result_cached_audio.InlineQueryResultCachedAudio`
|
||||
- :class:`aiogram.types.inline_query_result_cached_document.InlineQueryResultCachedDocument`
|
||||
- :class:`aiogram.types.inline_query_result_cached_gif.InlineQueryResultCachedGif`
|
||||
- :class:`aiogram.types.inline_query_result_cached_mpeg4_gif.InlineQueryResultCachedMpeg4Gif`
|
||||
- :class:`aiogram.types.inline_query_result_cached_photo.InlineQueryResultCachedPhoto`
|
||||
- :class:`aiogram.types.inline_query_result_cached_sticker.InlineQueryResultCachedSticker`
|
||||
- :class:`aiogram.types.inline_query_result_cached_video.InlineQueryResultCachedVideo`
|
||||
- :class:`aiogram.types.inline_query_result_cached_voice.InlineQueryResultCachedVoice`
|
||||
- :class:`aiogram.types.inline_query_result_article.InlineQueryResultArticle`
|
||||
- :class:`aiogram.types.inline_query_result_audio.InlineQueryResultAudio`
|
||||
- :class:`aiogram.types.inline_query_result_contact.InlineQueryResultContact`
|
||||
- :class:`aiogram.types.inline_query_result_game.InlineQueryResultGame`
|
||||
- :class:`aiogram.types.inline_query_result_document.InlineQueryResultDocument`
|
||||
- :class:`aiogram.types.inline_query_result_gif.InlineQueryResultGif`
|
||||
- :class:`aiogram.types.inline_query_result_location.InlineQueryResultLocation`
|
||||
- :class:`aiogram.types.inline_query_result_mpeg4_gif.InlineQueryResultMpeg4Gif`
|
||||
- :class:`aiogram.types.inline_query_result_photo.InlineQueryResultPhoto`
|
||||
- :class:`aiogram.types.inline_query_result_venue.InlineQueryResultVenue`
|
||||
- :class:`aiogram.types.inline_query_result_video.InlineQueryResultVideo`
|
||||
- :class:`aiogram.types.inline_query_result_voice.InlineQueryResultVoice`
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inlinequeryresult
|
||||
"""
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue