mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Added support of Bot API 6.2 (#975)
* Added support of Bot API 6.2 * Added changelog * Update tests * Update API version * Update dependencies, pre-commit config * Added pytest config
This commit is contained in:
parent
4315ecf1a2
commit
c1341ba2df
78 changed files with 523 additions and 785 deletions
|
|
@ -1 +1 @@
|
|||
6.1
|
||||
6.2
|
||||
|
|
|
|||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
- uses: actions/checkout@master
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,18 @@ repos:
|
|||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.2.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: check-merge-conflict
|
||||
- id: "trailing-whitespace"
|
||||
- id: "check-case-conflict"
|
||||
- id: "check-merge-conflict"
|
||||
- id: "debug-statements"
|
||||
- id: "end-of-file-fixer"
|
||||
- id: "mixed-line-ending"
|
||||
- id: "check-yaml"
|
||||
- id: "detect-private-key"
|
||||
- id: "check-toml"
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
rev: 22.6.0
|
||||
hooks:
|
||||
- id: black
|
||||
files: &files '^(aiogram|tests|examples)'
|
||||
|
|
@ -20,9 +26,15 @@ repos:
|
|||
- id: isort
|
||||
additional_dependencies: [ toml ]
|
||||
files: *files
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: [ '--config=.flake8' ]
|
||||
files: *files
|
||||
|
||||
- repo: https://github.com/floatingpurr/sync_with_poetry
|
||||
rev: 0.2.0
|
||||
hooks:
|
||||
- id: sync_with_poetry
|
||||
|
|
|
|||
1
CHANGES/975.misc.rst
Normal file
1
CHANGES/975.misc.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Added full support of `Bot API 6.2 <https://core.telegram.org/bots/api-changelog#august-12-2022>`_
|
||||
|
|
@ -13,7 +13,7 @@ aiogram |beta badge|
|
|||
:target: https://pypi.python.org/pypi/aiogram
|
||||
:alt: Supported python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.1-blue.svg?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.2-blue.svg?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api
|
||||
:alt: Telegram Bot API
|
||||
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ __all__ = (
|
|||
)
|
||||
|
||||
__version__ = "3.0.0b4"
|
||||
__api_version__ = "6.1"
|
||||
__api_version__ = "6.2"
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ from ..methods import (
|
|||
GetChatMemberCount,
|
||||
GetChatMembersCount,
|
||||
GetChatMenuButton,
|
||||
GetCustomEmojiStickers,
|
||||
GetFile,
|
||||
GetGameHighScores,
|
||||
GetMe,
|
||||
|
|
@ -152,6 +153,7 @@ from ..types import (
|
|||
ReplyKeyboardRemove,
|
||||
SentWebAppMessage,
|
||||
ShippingOption,
|
||||
Sticker,
|
||||
StickerSet,
|
||||
Update,
|
||||
User,
|
||||
|
|
@ -290,7 +292,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
try:
|
||||
if isinstance(destination, (str, pathlib.Path)):
|
||||
return await self.__download_file(destination=destination, stream=stream)
|
||||
await self.__download_file(destination=destination, stream=stream)
|
||||
return None
|
||||
else:
|
||||
return await self.__download_file_binary_io(
|
||||
destination=destination, seek=seek, stream=stream
|
||||
|
|
@ -383,7 +386,7 @@ 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 :class:`aiogram.types.update.Update` objects is returned.
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). Returns an Array of :class:`aiogram.types.update.Update` objects.
|
||||
|
||||
**Notes**
|
||||
|
||||
|
|
@ -398,7 +401,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member* (default). If not specified, the previous setting will be used.
|
||||
:param request_timeout: Request timeout
|
||||
:return: An Array of Update objects is returned.
|
||||
:return: Returns an Array of Update objects.
|
||||
"""
|
||||
call = GetUpdates(
|
||||
offset=offset,
|
||||
|
|
@ -570,7 +573,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -638,7 +641,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> MessageId:
|
||||
"""
|
||||
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, 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.
|
||||
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, 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
|
||||
|
||||
|
|
@ -651,7 +654,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -700,7 +703,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -757,7 +760,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -813,7 +816,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -869,11 +872,11 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
|
||||
:param supports_streaming: Pass :code:`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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -934,7 +937,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -988,7 +991,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1037,7 +1040,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1076,7 +1079,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param disable_notification: Sends messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.
|
||||
:param protect_content: Protects the contents of the sent messages from forwarding and saving
|
||||
:param reply_to_message_id: If the messages are a reply, ID of the original message
|
||||
: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 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.
|
||||
"""
|
||||
|
|
@ -1123,7 +1126,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1254,7 +1257,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1306,7 +1309,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1366,11 +1369,11 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param explanation_entities: A JSON-serialized 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 :code:`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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1420,7 +1423,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -1647,17 +1650,17 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
: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 :code:`True`, if the administrator's presence in the chat is hidden
|
||||
:param can_manage_chat: Pass :code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
|
||||
:param can_post_messages: Pass :code:`True`, if the administrator can create channel posts, channels only
|
||||
:param can_edit_messages: Pass :code:`True`, if the administrator can edit messages of other users and can pin messages, channels only
|
||||
:param can_delete_messages: Pass :code:`True`, if the administrator can delete messages of other users
|
||||
:param can_manage_video_chats: Pass :code:`True`, if the administrator can manage video chats
|
||||
:param can_restrict_members: Pass :code:`True`, if the administrator can restrict, ban or unban chat members
|
||||
:param can_promote_members: Pass :code:`True`, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
|
||||
:param can_change_info: Pass :code:`True`, if the administrator can change chat title, photo and other settings
|
||||
:param can_invite_users: Pass :code:`True`, if the administrator can invite new users to the chat
|
||||
:param can_pin_messages: Pass :code:`True`, if the administrator can pin messages, supergroups only
|
||||
:param is_anonymous: Pass :code:`True` if the administrator's presence in the chat is hidden
|
||||
:param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
|
||||
:param can_post_messages: Pass :code:`True` if the administrator can create channel posts, channels only
|
||||
:param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only
|
||||
:param can_delete_messages: Pass :code:`True` if the administrator can delete messages of other users
|
||||
:param can_manage_video_chats: Pass :code:`True` if the administrator can manage video chats
|
||||
:param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members
|
||||
:param can_promote_members: Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
|
||||
:param can_change_info: Pass :code:`True` if the administrator can change chat title, photo and other settings
|
||||
:param can_invite_users: Pass :code:`True` if the administrator can invite new users to the chat
|
||||
:param can_pin_messages: Pass :code:`True` if the administrator can pin messages, supergroups only
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
|
|
@ -2020,7 +2023,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
: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 :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 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.
|
||||
"""
|
||||
|
|
@ -2125,16 +2128,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
]
|
||||
]:
|
||||
"""
|
||||
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.
|
||||
Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatadministrators
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, returns an Array of ChatMember objects that contains information
|
||||
about all chat administrators except other bots. If the chat is a group or a
|
||||
supergroup and no administrators were appointed, only the creator will be
|
||||
returned.
|
||||
:return: Returns an Array of ChatMember objects.
|
||||
"""
|
||||
call = GetChatAdministrators(
|
||||
chat_id=chat_id,
|
||||
|
|
@ -2342,14 +2342,14 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
request_timeout: Optional[int] = None,
|
||||
) -> List[BotCommand]:
|
||||
"""
|
||||
Use this method to get the current list of the bot's commands for the given scope and user language. Returns Array of :class:`aiogram.types.bot_command.BotCommand` on success. If commands aren't set, an empty list is returned.
|
||||
Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of :class:`aiogram.types.bot_command.BotCommand` objects. If commands aren't set, an empty list is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getmycommands
|
||||
|
||||
:param scope: A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`.
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns Array of BotCommand on success. If commands aren't set, an empty list is
|
||||
:return: Returns an Array of BotCommand objects. If commands aren't set, an empty list is
|
||||
returned.
|
||||
"""
|
||||
call = GetMyCommands(
|
||||
|
|
@ -2676,7 +2676,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -2711,6 +2711,25 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def get_custom_emoji_stickers(
|
||||
self,
|
||||
custom_emoji_ids: List[str],
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> List[Sticker]:
|
||||
"""
|
||||
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getcustomemojistickers
|
||||
|
||||
:param custom_emoji_ids: List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns an Array of Sticker objects.
|
||||
"""
|
||||
call = GetCustomEmojiStickers(
|
||||
custom_emoji_ids=custom_emoji_ids,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def upload_sticker_file(
|
||||
self,
|
||||
user_id: int,
|
||||
|
|
@ -2742,7 +2761,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
png_sticker: Optional[Union[InputFile, str]] = None,
|
||||
tgs_sticker: Optional[InputFile] = None,
|
||||
webm_sticker: Optional[InputFile] = None,
|
||||
contains_masks: Optional[bool] = None,
|
||||
sticker_type: Optional[str] = None,
|
||||
mask_position: Optional[MaskPosition] = None,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
|
|
@ -2758,7 +2777,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 information on Sending Files » <sending-files>`
|
||||
:param tgs_sticker: **TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/stickers#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-requirements>`_`https://core.telegram.org/stickers#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-requirements>`_ for technical requirements
|
||||
:param webm_sticker: **WEBM** video with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/stickers#video-sticker-requirements <https://core.telegram.org/stickers#video-sticker-requirements>`_`https://core.telegram.org/stickers#video-sticker-requirements <https://core.telegram.org/stickers#video-sticker-requirements>`_ for technical requirements
|
||||
:param contains_masks: Pass :code:`True`, if a set of mask stickers should be created
|
||||
:param sticker_type: Type of stickers in the set, pass 'regular' or 'mask'. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is 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.
|
||||
|
|
@ -2771,7 +2790,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
png_sticker=png_sticker,
|
||||
tgs_sticker=tgs_sticker,
|
||||
webm_sticker=webm_sticker,
|
||||
contains_masks=contains_masks,
|
||||
sticker_type=sticker_type,
|
||||
mask_position=mask_position,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
|
@ -2905,7 +2924,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 :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 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.
|
||||
|
|
@ -3001,17 +3020,17 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param photo_size: Photo size in bytes
|
||||
:param photo_width: Photo width
|
||||
:param photo_height: Photo height
|
||||
: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 the user's phone number should be sent to provider
|
||||
:param send_email_to_provider: Pass :code:`True`, if the 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 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 the user's phone number should be sent to provider
|
||||
:param send_email_to_provider: Pass :code:`True` if the 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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -3089,13 +3108,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param photo_size: Photo size in bytes
|
||||
:param photo_width: Photo width
|
||||
:param photo_height: Photo height
|
||||
: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 the user's phone number should be sent to the provider
|
||||
:param send_email_to_provider: Pass :code:`True`, if the user's email address should be sent to the provider
|
||||
:param is_flexible: Pass :code:`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 the user's phone number should be sent to the provider
|
||||
:param send_email_to_provider: Pass :code:`True` if the user's email address should be sent to the provider
|
||||
:param is_flexible: Pass :code:`True` if the final price depends on the shipping method
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns the created invoice link as String on success.
|
||||
"""
|
||||
|
|
@ -3137,9 +3156,9 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
Source: https://core.telegram.org/bots/api#answershippingquery
|
||||
|
||||
:param shipping_query_id: Unique identifier for the query to be answered
|
||||
:param ok: Specify :code:`True` if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
|
||||
:param ok: Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)
|
||||
:param shipping_options: Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options.
|
||||
:param error_message: Required if *ok* is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:param error_message: Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
|
||||
:param request_timeout: Request timeout
|
||||
:return: On success, True is returned.
|
||||
"""
|
||||
|
|
@ -3232,7 +3251,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
: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 protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
: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 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.
|
||||
|
|
@ -3266,8 +3285,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
:param user_id: User identifier
|
||||
:param score: New score, must be non-negative
|
||||
:param force: Pass :code:`True`, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
|
||||
:param disable_edit_message: Pass :code:`True`, if the game message should not be automatically edited to include the current scoreboard
|
||||
:param force: Pass :code:`True` if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
|
||||
:param disable_edit_message: Pass :code:`True` if the game message should not be automatically edited to include the current scoreboard
|
||||
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat
|
||||
:param message_id: Required if *inline_message_id* is not specified. Identifier of the sent message
|
||||
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
|
||||
|
|
@ -3296,7 +3315,7 @@ 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 :class:`aiogram.types.game_high_score.GameHighScore` objects.
|
||||
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. 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 their neighbors are not among them. Please note that this behavior is subject to change.
|
||||
|
||||
|
|
@ -3308,10 +3327,10 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
|
||||
:param request_timeout: Request timeout
|
||||
:return: Will return the score of the specified user and several of their neighbors in a
|
||||
game. On success, returns an Array of GameHighScore objects. This method will
|
||||
currently return scores for the target user, plus two of their closest neighbors
|
||||
on each side. Will also return the top three users if the user and their
|
||||
neighbors are not among them.
|
||||
game. Returns an Array of GameHighScore objects. This method will currently
|
||||
return scores for the target user, plus two of their closest neighbors on each
|
||||
side. Will also return the top three users if the user and their neighbors are
|
||||
not among them.
|
||||
"""
|
||||
call = GetGameHighScores(
|
||||
user_id=user_id,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ from .get_chat_member import GetChatMember
|
|||
from .get_chat_member_count import GetChatMemberCount
|
||||
from .get_chat_members_count import GetChatMembersCount
|
||||
from .get_chat_menu_button import GetChatMenuButton
|
||||
from .get_custom_emoji_stickers import GetCustomEmojiStickers
|
||||
from .get_file import GetFile
|
||||
from .get_game_high_scores import GetGameHighScores
|
||||
from .get_me import GetMe
|
||||
|
|
@ -168,6 +169,7 @@ __all__ = (
|
|||
"DeleteMessage",
|
||||
"SendSticker",
|
||||
"GetStickerSet",
|
||||
"GetCustomEmojiStickers",
|
||||
"UploadStickerFile",
|
||||
"CreateNewStickerSet",
|
||||
"AddStickerToSet",
|
||||
|
|
|
|||
|
|
@ -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 :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"""
|
||||
"""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
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ class AnswerShippingQuery(TelegramMethod[bool]):
|
|||
shipping_query_id: str
|
||||
"""Unique identifier for the query to be answered"""
|
||||
ok: bool
|
||||
"""Specify :code:`True` if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)"""
|
||||
"""Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)"""
|
||||
shipping_options: Optional[List[ShippingOption]] = None
|
||||
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
|
||||
error_message: Optional[str] = None
|
||||
"""Required if *ok* is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
|
||||
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class CopyMessage(TelegramMethod[MessageId]):
|
||||
"""
|
||||
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, 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.
|
||||
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, 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
|
||||
"""
|
||||
|
|
@ -45,7 +45,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -45,19 +45,19 @@ class CreateInvoiceLink(TelegramMethod[str]):
|
|||
photo_height: Optional[int] = None
|
||||
"""Photo height"""
|
||||
need_name: Optional[bool] = None
|
||||
"""Pass :code:`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 :code:`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 :code:`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 :code:`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 :code:`True`, if the user's phone number should be sent to the provider"""
|
||||
"""Pass :code:`True` if the user's phone number should be sent to the provider"""
|
||||
send_email_to_provider: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the user's email address should be sent to the provider"""
|
||||
"""Pass :code:`True` if the user's email address should be sent to the provider"""
|
||||
is_flexible: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the final price depends on the shipping method"""
|
||||
"""Pass :code:`True` if the final price depends on the shipping method"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ class CreateNewStickerSet(TelegramMethod[bool]):
|
|||
"""**TGS** animation with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/stickers#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-requirements>`_`https://core.telegram.org/stickers#animated-sticker-requirements <https://core.telegram.org/stickers#animated-sticker-requirements>`_ for technical requirements"""
|
||||
webm_sticker: Optional[InputFile] = None
|
||||
"""**WEBM** video with the sticker, uploaded using multipart/form-data. See `https://core.telegram.org/stickers#video-sticker-requirements <https://core.telegram.org/stickers#video-sticker-requirements>`_`https://core.telegram.org/stickers#video-sticker-requirements <https://core.telegram.org/stickers#video-sticker-requirements>`_ for technical requirements"""
|
||||
contains_masks: Optional[bool] = None
|
||||
"""Pass :code:`True`, if a set of mask stickers should be created"""
|
||||
sticker_type: Optional[str] = None
|
||||
"""Type of stickers in the set, pass 'regular' or 'mask'. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created."""
|
||||
mask_position: Optional[MaskPosition] = None
|
||||
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class GetChatAdministrators(
|
|||
]
|
||||
):
|
||||
"""
|
||||
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.
|
||||
Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatadministrators
|
||||
"""
|
||||
|
|
|
|||
27
aiogram/methods/get_custom_emoji_stickers.py
Normal file
27
aiogram/methods/get_custom_emoji_stickers.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Dict, List
|
||||
|
||||
from ..types import Sticker
|
||||
from .base import Request, TelegramMethod
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..client.bot import Bot
|
||||
|
||||
|
||||
class GetCustomEmojiStickers(TelegramMethod[List[Sticker]]):
|
||||
"""
|
||||
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getcustomemojistickers
|
||||
"""
|
||||
|
||||
__returning__ = List[Sticker]
|
||||
|
||||
custom_emoji_ids: List[str]
|
||||
"""List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="getCustomEmojiStickers", data=data)
|
||||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|||
|
||||
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 :class:`aiogram.types.game_high_score.GameHighScore` objects.
|
||||
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. 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 their neighbors are not among them. Please note that this behavior is subject to change.
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class GetMyCommands(TelegramMethod[List[BotCommand]]):
|
||||
"""
|
||||
Use this method to get the current list of the bot's commands for the given scope and user language. Returns Array of :class:`aiogram.types.bot_command.BotCommand` on success. If commands aren't set, an empty list is returned.
|
||||
Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of :class:`aiogram.types.bot_command.BotCommand` objects. If commands aren't set, an empty list is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getmycommands
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|||
|
||||
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 :class:`aiogram.types.update.Update` objects is returned.
|
||||
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). Returns an Array of :class:`aiogram.types.update.Update` objects.
|
||||
|
||||
**Notes**
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class PinChatMessage(TelegramMethod[bool]):
|
|||
message_id: int
|
||||
"""Identifier of a message to pin"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""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."""
|
||||
"""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()
|
||||
|
|
|
|||
|
|
@ -22,27 +22,27 @@ class PromoteChatMember(TelegramMethod[bool]):
|
|||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
is_anonymous: Optional[bool] = None
|
||||
"""Pass :code:`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_manage_chat: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
|
||||
"""Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
|
||||
can_post_messages: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can create channel posts, channels only"""
|
||||
"""Pass :code:`True` if the administrator can create channel posts, channels only"""
|
||||
can_edit_messages: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can edit messages of other users and can pin messages, channels only"""
|
||||
"""Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only"""
|
||||
can_delete_messages: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can delete messages of other users"""
|
||||
"""Pass :code:`True` if the administrator can delete messages of other users"""
|
||||
can_manage_video_chats: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can manage video chats"""
|
||||
"""Pass :code:`True` if the administrator can manage video chats"""
|
||||
can_restrict_members: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can restrict, ban or unban chat members"""
|
||||
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members"""
|
||||
can_promote_members: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
|
||||
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
|
||||
can_change_info: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can change chat title, photo and other settings"""
|
||||
"""Pass :code:`True` if the administrator can change chat title, photo and other settings"""
|
||||
can_invite_users: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can invite new users to the chat"""
|
||||
"""Pass :code:`True` if the administrator can invite new users to the chat"""
|
||||
can_pin_messages: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the administrator can pin messages, supergroups only"""
|
||||
"""Pass :code:`True` if the administrator can pin messages, supergroups only"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -52,7 +52,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class SendAudio(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -41,7 +41,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class SendDice(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -48,7 +48,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -29,7 +29,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 :code:`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."""
|
||||
|
||||
|
|
|
|||
|
|
@ -49,19 +49,19 @@ class SendInvoice(TelegramMethod[Message]):
|
|||
photo_height: Optional[int] = None
|
||||
"""Photo height"""
|
||||
need_name: Optional[bool] = None
|
||||
"""Pass :code:`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 :code:`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 :code:`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 :code:`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 :code:`True`, if the user's phone number should be sent to provider"""
|
||||
"""Pass :code:`True` if the user's phone number should be sent to provider"""
|
||||
send_email_to_provider: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the user's email address should be sent to provider"""
|
||||
"""Pass :code:`True` if the user's email address should be sent to provider"""
|
||||
is_flexible: Optional[bool] = None
|
||||
"""Pass :code:`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."""
|
||||
protect_content: Optional[bool] = None
|
||||
|
|
@ -69,7 +69,7 @@ class SendInvoice(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 :code:`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."""
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -36,7 +36,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 :code:`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()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -44,7 +44,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ 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 :code:`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."""
|
||||
protect_content: Optional[bool] = None
|
||||
|
|
@ -60,7 +60,7 @@ class SendPoll(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SendSticker(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -49,7 +49,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class SendVideo(TelegramMethod[Message]):
|
|||
caption_entities: Optional[List[MessageEntity]] = None
|
||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||
supports_streaming: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the uploaded video is suitable for streaming"""
|
||||
"""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."""
|
||||
protect_content: Optional[bool] = None
|
||||
|
|
@ -54,7 +54,7 @@ class SendVideo(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class SendVideoNote(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 :code:`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
|
||||
|
|
|
|||
|
|
@ -46,7 +46,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 :code:`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
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
|
|||
score: int
|
||||
"""New score, must be non-negative"""
|
||||
force: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"""
|
||||
"""Pass :code:`True` if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"""
|
||||
disable_edit_message: Optional[bool] = None
|
||||
"""Pass :code:`True`, if the game message should not be automatically edited to include the current scoreboard"""
|
||||
"""Pass :code:`True` if the game message should not be automatically edited to include the current scoreboard"""
|
||||
chat_id: Optional[int] = None
|
||||
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat"""
|
||||
message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from typing import Optional
|
||||
|
||||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
from .base import UNSET, TelegramObject
|
||||
|
|
@ -284,7 +286,10 @@ for _entity_name in __all__:
|
|||
_entity = globals()[_entity_name]
|
||||
if not hasattr(_entity, "update_forward_refs"):
|
||||
continue
|
||||
_entity.update_forward_refs(**globals())
|
||||
_entity.update_forward_refs(
|
||||
**{k: v for k, v in globals().items() if k in __all__},
|
||||
**{"Optional": Optional},
|
||||
)
|
||||
|
||||
del _entity
|
||||
del _entity_name
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ class Chat(TelegramObject):
|
|||
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
has_private_forwards: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if privacy settings of the other party in the private chat allows to use :code:`tg://user?id=<user_id>` links only in chats with the user. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
has_restricted_voice_and_video_messages: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
join_to_send_messages: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if users need to join the supergroup before they can send messages. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
join_by_request: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
url: Optional[str] = None
|
||||
"""*Optional*. URL of the result"""
|
||||
hide_url: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if you don't want the URL to be shown in the message"""
|
||||
"""*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message"""
|
||||
description: Optional[str] = None
|
||||
"""*Optional*. Short description of the result"""
|
||||
thumb_url: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -42,16 +42,16 @@ class InputInvoiceMessageContent(InputMessageContent):
|
|||
photo_height: Optional[int] = None
|
||||
"""*Optional*. Photo height"""
|
||||
need_name: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if you require the user's full name to complete the order"""
|
||||
"""*Optional*. Pass :code:`True` if you require the user's full name to complete the order"""
|
||||
need_phone_number: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if you require the user's phone number to complete the order"""
|
||||
"""*Optional*. Pass :code:`True` if you require the user's phone number to complete the order"""
|
||||
need_email: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if you require the user's email address to complete the order"""
|
||||
"""*Optional*. Pass :code:`True` if you require the user's email address to complete the order"""
|
||||
need_shipping_address: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if you require the user's shipping address to complete the order"""
|
||||
"""*Optional*. Pass :code:`True` if you require the user's shipping address to complete the order"""
|
||||
send_phone_number_to_provider: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if the user's phone number should be sent to provider"""
|
||||
"""*Optional*. Pass :code:`True` if the user's phone number should be sent to provider"""
|
||||
send_email_to_provider: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if the user's email address should be sent to provider"""
|
||||
"""*Optional*. Pass :code:`True` if the user's email address should be sent to provider"""
|
||||
is_flexible: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if the final price depends on the shipping method"""
|
||||
"""*Optional*. Pass :code:`True` if the final price depends on the shipping method"""
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@ class InputMediaVideo(InputMedia):
|
|||
duration: Optional[int] = None
|
||||
"""*Optional*. Video duration in seconds"""
|
||||
supports_streaming: Optional[bool] = None
|
||||
"""*Optional*. Pass :code:`True`, if the uploaded video is suitable for streaming"""
|
||||
"""*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming"""
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ if TYPE_CHECKING:
|
|||
from .web_app_info import WebAppInfo
|
||||
|
||||
|
||||
class WebApp(MutableTelegramObject):
|
||||
url: str
|
||||
|
||||
|
||||
class KeyboardButton(MutableTelegramObject):
|
||||
"""
|
||||
This object represents one button of the reply keyboard. For simple text buttons *String* can be used instead of this object to specify text of the button. Optional fields *web_app*, *request_contact*, *request_location*, and *request_poll* are mutually exclusive.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class LoginUrl(TelegramObject):
|
|||
"""
|
||||
|
||||
url: str
|
||||
"""An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in `Receiving authorization data <https://core.telegram.org/widgets/login#receiving-authorization-data>`_."""
|
||||
"""An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in `Receiving authorization data <https://core.telegram.org/widgets/login#receiving-authorization-data>`_."""
|
||||
forward_text: Optional[str] = None
|
||||
"""*Optional*. New text of the button in forwarded messages."""
|
||||
bot_username: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
from .web_app_info import WebAppInfo
|
||||
|
||||
|
||||
class MenuButton(TelegramObject):
|
||||
|
|
@ -20,3 +20,10 @@ class MenuButton(TelegramObject):
|
|||
|
||||
Source: https://core.telegram.org/bots/api#menubutton
|
||||
"""
|
||||
|
||||
type: str
|
||||
"""..."""
|
||||
text: Optional[str] = None
|
||||
"""*Optional*. Text on the button"""
|
||||
web_app: Optional[WebAppInfo] = None
|
||||
"""*Optional*. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`."""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class MessageEntity(MutableTelegramObject):
|
|||
"""
|
||||
|
||||
type: str
|
||||
"""Type of the entity. Currently, can be 'mention' (:code:`@username`), 'hashtag' (:code:`#hashtag`), 'cashtag' (:code:`$USD`), 'bot_command' (:code:`/start@jobs_bot`), 'url' (:code:`https://telegram.org`), 'email' (:code:`do-not-reply@telegram.org`), 'phone_number' (:code:`+1-212-555-0123`), 'bold' (**bold text**), 'italic' (*italic text*), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'spoiler' (spoiler message), 'code' (monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs), 'text_mention' (for users `without usernames <https://telegram.org/blog/edit#new-mentions>`_)"""
|
||||
"""Type of the entity. Currently, can be 'mention' (:code:`@username`), 'hashtag' (:code:`#hashtag`), 'cashtag' (:code:`$USD`), 'bot_command' (:code:`/start@jobs_bot`), 'url' (:code:`https://telegram.org`), 'email' (:code:`do-not-reply@telegram.org`), 'phone_number' (:code:`+1-212-555-0123`), 'bold' (**bold text**), 'italic' (*italic text*), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'spoiler' (spoiler message), 'code' (monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs), 'text_mention' (for users `without usernames <https://telegram.org/blog/edit#new-mentions>`_), 'custom_emoji' (for inline custom emoji stickers)"""
|
||||
offset: int
|
||||
"""Offset in UTF-16 code units to the start of the entity"""
|
||||
length: int
|
||||
|
|
@ -29,6 +29,8 @@ class MessageEntity(MutableTelegramObject):
|
|||
"""*Optional*. For 'text_mention' only, the mentioned user"""
|
||||
language: Optional[str] = None
|
||||
"""*Optional*. For 'pre' only, the programming language of the entity text"""
|
||||
custom_emoji_id: Optional[str] = None
|
||||
"""*Optional*. For 'custom_emoji' only, unique identifier of the custom emoji. Use :class:`aiogram.methods.get_custom_emoji_stickers.GetCustomEmojiStickers` to get full information about the sticker"""
|
||||
|
||||
def extract_from(self, text: str) -> str:
|
||||
return remove_surrogates(
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class Sticker(TelegramObject):
|
|||
"""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."""
|
||||
type: str
|
||||
"""Type of the sticker, currently one of 'regular', 'mask', 'custom_emoji'. The type of the sticker is independent from its format, which is determined by the fields *is_animated* and *is_video*."""
|
||||
width: int
|
||||
"""Sticker width"""
|
||||
height: int
|
||||
|
|
@ -36,8 +38,10 @@ class Sticker(TelegramObject):
|
|||
set_name: Optional[str] = None
|
||||
"""*Optional*. Name of the sticker set to which the sticker belongs"""
|
||||
premium_animation: Optional[File] = None
|
||||
"""*Optional*. Premium animation for the sticker, if the sticker is premium"""
|
||||
"""*Optional*. For premium regular stickers, premium animation for the sticker"""
|
||||
mask_position: Optional[MaskPosition] = None
|
||||
"""*Optional*. For mask stickers, the position where the mask should be placed"""
|
||||
custom_emoji_id: Optional[str] = None
|
||||
"""*Optional*. For custom emoji stickers, unique identifier of the custom emoji"""
|
||||
file_size: Optional[int] = None
|
||||
"""*Optional*. File size in bytes"""
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ class StickerSet(TelegramObject):
|
|||
"""Sticker set name"""
|
||||
title: str
|
||||
"""Sticker set title"""
|
||||
sticker_type: str
|
||||
"""Type of stickers in the set, currently one of 'regular', 'mask', 'custom_emoji'"""
|
||||
is_animated: bool
|
||||
""":code:`True`, if the sticker set contains `animated stickers <https://telegram.org/blog/animated-stickers>`_"""
|
||||
is_video: bool
|
||||
""":code:`True`, if the sticker set contains `video stickers <https://telegram.org/blog/video-stickers-better-reactions>`_"""
|
||||
contains_masks: bool
|
||||
""":code:`True`, if the sticker set contains masks"""
|
||||
stickers: List[Sticker]
|
||||
"""List of all set stickers"""
|
||||
thumb: Optional[PhotoSize] = None
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class TextDecoration(ABC):
|
|||
return self.link(value=text, link=f"tg://user?id={user.id}")
|
||||
if entity.type == "text_link":
|
||||
return self.link(value=text, link=cast(str, entity.url))
|
||||
if entity.type == "custom_emoji":
|
||||
return self.custom_emoji(value=text, custom_emoji_id=cast(str, entity.custom_emoji_id))
|
||||
|
||||
return self.quote(text)
|
||||
|
||||
|
|
@ -140,7 +142,11 @@ class TextDecoration(ABC):
|
|||
pass
|
||||
|
||||
@abstractmethod
|
||||
def quote(self, value: str) -> str: # pragma: no cover
|
||||
def quote(self, value: str) -> str:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def custom_emoji(self, value: str, custom_emoji_id: str) -> str:
|
||||
pass
|
||||
|
||||
|
||||
|
|
@ -149,7 +155,8 @@ class HtmlDecoration(TextDecoration):
|
|||
ITALIC_TAG = "i"
|
||||
UNDERLINE_TAG = "u"
|
||||
STRIKETHROUGH_TAG = "s"
|
||||
SPOILER_TAG = ('span class="tg-spoiler"', "span")
|
||||
SPOILER_TAG = "tg-spoiler"
|
||||
EMOJI_TAG = "tg-emoji"
|
||||
|
||||
def link(self, value: str, link: str) -> str:
|
||||
return f'<a href="{link}">{value}</a>'
|
||||
|
|
@ -176,11 +183,14 @@ class HtmlDecoration(TextDecoration):
|
|||
return f"<{self.STRIKETHROUGH_TAG}>{value}</{self.STRIKETHROUGH_TAG}>"
|
||||
|
||||
def spoiler(self, value: str) -> str:
|
||||
return f"<{self.SPOILER_TAG[0]}>{value}</{self.SPOILER_TAG[1]}>"
|
||||
return f"<{self.SPOILER_TAG}>{value}</{self.SPOILER_TAG}>"
|
||||
|
||||
def quote(self, value: str) -> str:
|
||||
return html.escape(value, quote=False)
|
||||
|
||||
def custom_emoji(self, value: str, custom_emoji_id: str) -> str:
|
||||
return f'<{self.EMOJI_TAG} emoji-id="{custom_emoji_id}">{value}</tg-emoji>'
|
||||
|
||||
|
||||
class MarkdownDecoration(TextDecoration):
|
||||
MARKDOWN_QUOTE_PATTERN: Pattern[str] = re.compile(r"([_*\[\]()~`>#+\-=|{}.!\\])")
|
||||
|
|
@ -215,6 +225,9 @@ class MarkdownDecoration(TextDecoration):
|
|||
def quote(self, value: str) -> str:
|
||||
return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value)
|
||||
|
||||
def custom_emoji(self, value: str, custom_emoji_id: str) -> str:
|
||||
return self.link(value=value, link=f"tg://emoji?id={custom_emoji_id}")
|
||||
|
||||
|
||||
html_decoration = HtmlDecoration()
|
||||
markdown_decoration = MarkdownDecoration()
|
||||
|
|
|
|||
37
docs/api/methods/get_custom_emoji_stickers.rst
Normal file
37
docs/api/methods/get_custom_emoji_stickers.rst
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
######################
|
||||
getCustomEmojiStickers
|
||||
######################
|
||||
|
||||
Returns: :obj:`List[Sticker]`
|
||||
|
||||
.. automodule:: aiogram.methods.get_custom_emoji_stickers
|
||||
:members:
|
||||
:member-order: bysource
|
||||
:undoc-members: True
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
As bot method
|
||||
-------------
|
||||
|
||||
.. code-block::
|
||||
|
||||
result: List[Sticker] = await bot.get_custom_emoji_stickers(...)
|
||||
|
||||
|
||||
Method as object
|
||||
----------------
|
||||
|
||||
Imports:
|
||||
|
||||
- :code:`from aiogram.methods.get_custom_emoji_stickers import GetCustomEmojiStickers`
|
||||
- alias: :code:`from aiogram.methods import GetCustomEmojiStickers`
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: List[Sticker] = await bot(GetCustomEmojiStickers(...))
|
||||
|
|
@ -108,6 +108,7 @@ Stickers
|
|||
|
||||
send_sticker
|
||||
get_sticker_set
|
||||
get_custom_emoji_stickers
|
||||
upload_sticker_file
|
||||
create_new_sticker_set
|
||||
add_sticker_to_set
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.send_chat_action import SendChatAction`
|
||||
- alias: :code:`from aiogram.methods import SendChatAction`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SendChatAction(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_chat_sticker_set import SetChatStickerSet`
|
||||
- alias: :code:`from aiogram.methods import SetChatStickerSet`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetChatStickerSet(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_chat_title import SetChatTitle`
|
||||
- alias: :code:`from aiogram.methods import SetChatTitle`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetChatTitle(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_game_score import SetGameScore`
|
||||
- alias: :code:`from aiogram.methods import SetGameScore`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: Union[Message, bool] = await SetGameScore(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_my_commands import SetMyCommands`
|
||||
- alias: :code:`from aiogram.methods import SetMyCommands`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetMyCommands(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_my_default_administrator_rights import SetMyDefaultAdministratorRights`
|
||||
- alias: :code:`from aiogram.methods import SetMyDefaultAdministratorRights`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetMyDefaultAdministratorRights(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_passport_data_errors import SetPassportDataErrors`
|
||||
- alias: :code:`from aiogram.methods import SetPassportDataErrors`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetPassportDataErrors(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_sticker_position_in_set import SetStickerPositionInSet`
|
||||
- alias: :code:`from aiogram.methods import SetStickerPositionInSet`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetStickerPositionInSet(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_sticker_set_thumb import SetStickerSetThumb`
|
||||
- alias: :code:`from aiogram.methods import SetStickerSetThumb`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetStickerSetThumb(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.set_webhook import SetWebhook`
|
||||
- alias: :code:`from aiogram.methods import SetWebhook`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await SetWebhook(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.stop_message_live_location import StopMessageLiveLocation`
|
||||
- alias: :code:`from aiogram.methods import StopMessageLiveLocation`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: Union[Message, bool] = await StopMessageLiveLocation(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.stop_poll import StopPoll`
|
||||
- alias: :code:`from aiogram.methods import StopPoll`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: Poll = await StopPoll(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.unban_chat_member import UnbanChatMember`
|
||||
- alias: :code:`from aiogram.methods import UnbanChatMember`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await UnbanChatMember(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.unban_chat_sender_chat import UnbanChatSenderChat`
|
||||
- alias: :code:`from aiogram.methods import UnbanChatSenderChat`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await UnbanChatSenderChat(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.unpin_all_chat_messages import UnpinAllChatMessages`
|
||||
- alias: :code:`from aiogram.methods import UnpinAllChatMessages`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await UnpinAllChatMessages(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.unpin_chat_message import UnpinChatMessage`
|
||||
- alias: :code:`from aiogram.methods import UnpinChatMessage`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: bool = await UnpinChatMessage(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ Imports:
|
|||
- :code:`from aiogram.methods.upload_sticker_file import UploadStickerFile`
|
||||
- alias: :code:`from aiogram.methods import UploadStickerFile`
|
||||
|
||||
In handlers with current bot
|
||||
----------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result: File = await UploadStickerFile(...)
|
||||
|
||||
With specific bot
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
621
poetry.lock
generated
621
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -37,9 +37,9 @@ classifiers = [
|
|||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
magic-filter = "^1.0.7"
|
||||
magic-filter = "^1.0.8"
|
||||
aiohttp = "^3.8.1"
|
||||
pydantic = "^1.9.1"
|
||||
pydantic = "^1.9.2"
|
||||
aiofiles = "^0.8.0"
|
||||
# Fast
|
||||
uvloop = { version = "^0.16.0", markers = "sys_platform == 'darwin' or sys_platform == 'linux'", optional = true }
|
||||
|
|
@ -48,41 +48,41 @@ Babel = { version = "^2.9.1", optional = true }
|
|||
# Proxy
|
||||
aiohttp-socks = { version = "^0.7.1", optional = true }
|
||||
# Redis
|
||||
redis = {version = "^4.3.3", optional = true}
|
||||
redis = { version = "^4.3.4", optional = true }
|
||||
# Docs
|
||||
Sphinx = { version = "^4.2.0", optional = true }
|
||||
sphinx-intl = {version = "^2.0.1", optional = true}
|
||||
sphinx-intl = { version = "^2.0.1", optional = true }
|
||||
sphinx-autobuild = { version = "^2021.3.14", optional = true }
|
||||
sphinx-copybutton = { version = "^0.5.0", optional = true }
|
||||
furo = {version = "^2022.6.21", optional = true}
|
||||
furo = { version = "^2022.6.21", optional = true }
|
||||
sphinx-prompt = { version = "^1.5.0", optional = true }
|
||||
Sphinx-Substitution-Extensions = { version = "^2020.9.30", optional = true }
|
||||
towncrier = { version = "^21.9.0", optional = true }
|
||||
pygments = { version = "^2.4", optional = true }
|
||||
pymdown-extensions = {version = "^9.5", optional = true}
|
||||
markdown-include = { version = "^0.6", optional = true }
|
||||
Pygments = {version = "^2.12.0", optional = true}
|
||||
pymdown-extensions = { version = "^9.5", optional = true }
|
||||
markdown-include = { version = "^0.7.0", optional = true }
|
||||
Pygments = { version = "^2.12.0", optional = true }
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
black = "^22.1.0"
|
||||
black = "^22.6.0"
|
||||
isort = "^5.10.1"
|
||||
flake8 = "^4.0.1"
|
||||
mypy = "^0.961"
|
||||
flake8 = "^5.0.4"
|
||||
mypy = "^0.971"
|
||||
pytest = "^7.1.2"
|
||||
pytest-html = "^3.1.1"
|
||||
pytest-asyncio = "^0.18.1"
|
||||
pytest-asyncio = "^0.19.0"
|
||||
pytest-lazy-fixture = "^0.6.3"
|
||||
pytest-mock = "^3.8.1"
|
||||
pytest-mock = "^3.8.2"
|
||||
pytest-mypy = "^0.9.1"
|
||||
pytest-cov = "^3.0.0"
|
||||
pytest-aiohttp = "^1.0.4"
|
||||
aresponses = "^2.1.5"
|
||||
aresponses = "^2.1.6"
|
||||
asynctest = "^0.13.0"
|
||||
toml = "^0.10.2"
|
||||
|
||||
pre-commit = "^2.19.0"
|
||||
pre-commit = "^2.20.0"
|
||||
packaging = "^21.3"
|
||||
typing-extensions = "^4.2.0"
|
||||
typing-extensions = "^4.3.0"
|
||||
|
||||
|
||||
[tool.poetry.extras]
|
||||
|
|
|
|||
4
pytest.ini
Normal file
4
pytest.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[pytest]
|
||||
asyncio_mode = auto
|
||||
testpaths =
|
||||
tests
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
from typing import List
|
||||
|
||||
import pytest
|
||||
|
||||
from aiogram.methods import GetCustomEmojiStickers, Request
|
||||
from aiogram.types import Sticker
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestGetCustomEmojiStickers:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
GetCustomEmojiStickers,
|
||||
ok=True,
|
||||
result=[
|
||||
Sticker(
|
||||
file_id="file id",
|
||||
width=42,
|
||||
height=42,
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
custom_emoji_id="1",
|
||||
type="custom_emoji",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[Sticker] = await GetCustomEmojiStickers(
|
||||
custom_emoji_ids=["1"],
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getCustomEmojiStickers"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
GetCustomEmojiStickers,
|
||||
ok=True,
|
||||
result=[
|
||||
Sticker(
|
||||
file_id="file id",
|
||||
width=42,
|
||||
height=42,
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
custom_emoji_id="1",
|
||||
type="custom_emoji",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[Sticker] = await bot.get_custom_emoji_stickers(
|
||||
custom_emoji_ids=["1", "2"],
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getCustomEmojiStickers"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -17,7 +17,6 @@ class TestGetStickerSet:
|
|||
title="test",
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
contains_masks=False,
|
||||
stickers=[
|
||||
Sticker(
|
||||
file_id="file if",
|
||||
|
|
@ -26,8 +25,10 @@ class TestGetStickerSet:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
)
|
||||
],
|
||||
sticker_type="regular",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -45,7 +46,6 @@ class TestGetStickerSet:
|
|||
title="test",
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
contains_masks=False,
|
||||
stickers=[
|
||||
Sticker(
|
||||
file_id="file if",
|
||||
|
|
@ -54,8 +54,10 @@ class TestGetStickerSet:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
)
|
||||
],
|
||||
sticker_type="regular",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class TestSendSticker:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
|
|
@ -48,6 +49,7 @@ class TestSendSticker:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ TEST_MESSAGE_STICKER = Message(
|
|||
height=42,
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
type="regular",
|
||||
),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
|
|
|
|||
|
|
@ -50,7 +50,12 @@ class TestTextDecoration:
|
|||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="spoiler", offset=0, length=5),
|
||||
'<span class="tg-spoiler">test</span>',
|
||||
"<tg-spoiler>test</tg-spoiler>",
|
||||
],
|
||||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),
|
||||
'<tg-emoji emoji-id="42">test</tg-emoji>',
|
||||
],
|
||||
[
|
||||
html_decoration,
|
||||
|
|
@ -82,6 +87,11 @@ class TestTextDecoration:
|
|||
[markdown_decoration, MessageEntity(type="email", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="phone_number", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "|test|"],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),
|
||||
"[test](tg://emoji?id=42)",
|
||||
],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue