mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Supports Bot API 4.6 (Broken tests)
This commit is contained in:
parent
213f2a3c16
commit
ae55497842
51 changed files with 244 additions and 63 deletions
|
|
@ -31,7 +31,7 @@ Imports:
|
|||
- `from aiogram.api.methods import DeleteWebhook`
|
||||
- `from aiogram.api.methods.delete_webhook import DeleteWebhook`
|
||||
|
||||
#### As reply into Webhook
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteWebhook(...)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -2,16 +2,21 @@
|
|||
|
||||
## Description
|
||||
|
||||
Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned.
|
||||
Use this method to send a native poll. On success, the sent Message is returned.
|
||||
|
||||
|
||||
## Arguments
|
||||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat. |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `question` | `#!python3 str` | Poll question, 1-255 characters |
|
||||
| `options` | `#!python3 List[str]` | List of answer options, 2-10 strings 1-100 characters each |
|
||||
| `is_anonymous` | `#!python3 Optional[bool]` | Optional. True, if the poll needs to be anonymous, defaults to True |
|
||||
| `type` | `#!python3 Optional[str]` | Optional. Poll type, 'quiz' or 'regular', defaults to 'regular' |
|
||||
| `allows_multiple_answers` | `#!python3 Optional[bool]` | Optional. True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False |
|
||||
| `correct_option_id` | `#!python3 Optional[int]` | Optional. 0-based identifier of the correct answer option, required for polls in quiz mode |
|
||||
| `is_closed` | `#!python3 Optional[bool]` | Optional. Pass True, if the poll needs to be immediately closed |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
## Description
|
||||
|
||||
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
|
||||
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.
|
||||
|
||||
Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
|
||||
Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will receive unsupported message.
|
||||
|
||||
Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will receive unsupported message.
|
||||
|
||||
|
||||
## Attributes
|
||||
|
|
@ -14,6 +16,7 @@ Note: request_contact and request_location options will only work in Telegram ve
|
|||
| `text` | `#!python str` | Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed |
|
||||
| `request_contact` | `#!python Optional[bool]` | Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only |
|
||||
| `request_location` | `#!python Optional[bool]` | Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only |
|
||||
| `request_poll` | `#!python Optional[KeyboardButtonPollType]` | Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only |
|
||||
|
||||
|
||||
|
||||
|
|
@ -26,3 +29,4 @@ Note: request_contact and request_location options will only work in Telegram ve
|
|||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#keyboardbutton)
|
||||
- [aiogram.types.KeyboardButtonPollType](../types/keyboard_button_poll_type.md)
|
||||
|
|
|
|||
24
docs/api/types/keyboard_button_poll_type.md
Normal file
24
docs/api/types/keyboard_button_poll_type.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# KeyboardButtonPollType
|
||||
|
||||
## Description
|
||||
|
||||
This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
|
||||
|
||||
|
||||
## Attributes
|
||||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `type` | `#!python Optional[str]` | Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. |
|
||||
|
||||
|
||||
|
||||
## Location
|
||||
|
||||
- `from aiogram.types import KeyboardButtonPollType`
|
||||
- `from aiogram.api.types import KeyboardButtonPollType`
|
||||
- `from aiogram.api.types.keyboard_button_poll_type import KeyboardButtonPollType`
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#keyboardbuttonpolltype)
|
||||
|
|
@ -14,6 +14,7 @@ This object represents one special entity in a text message. For example, hashta
|
|||
| `length` | `#!python int` | Length of the entity in UTF-16 code units |
|
||||
| `url` | `#!python Optional[str]` | Optional. For 'text_link' only, url that will be opened after user taps on the text |
|
||||
| `user` | `#!python Optional[User]` | Optional. For 'text_mention' only, the mentioned user |
|
||||
| `language` | `#!python Optional[str]` | Optional. For 'pre' only, the programming language of the entity text |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ This object contains information about a poll.
|
|||
| `id` | `#!python str` | Unique poll identifier |
|
||||
| `question` | `#!python str` | Poll question, 1-255 characters |
|
||||
| `options` | `#!python List[PollOption]` | List of poll options |
|
||||
| `total_voter_count` | `#!python int` | Total number of users that voted in the poll |
|
||||
| `is_closed` | `#!python bool` | True, if the poll is closed |
|
||||
| `is_anonymous` | `#!python bool` | True, if the poll is anonymous |
|
||||
| `type` | `#!python str` | Poll type, currently can be 'regular' or 'quiz' |
|
||||
| `allows_multiple_answers` | `#!python bool` | True, if the poll allows multiple answers |
|
||||
| `correct_option_id` | `#!python Optional[int]` | Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
27
docs/api/types/poll_answer.md
Normal file
27
docs/api/types/poll_answer.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# PollAnswer
|
||||
|
||||
## Description
|
||||
|
||||
This object represents an answer of a user in a non-anonymous poll.
|
||||
|
||||
|
||||
## Attributes
|
||||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `poll_id` | `#!python str` | Unique poll identifier |
|
||||
| `user` | `#!python User` | The user, who changed the answer to the poll |
|
||||
| `option_ids` | `#!python List[int]` | 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. |
|
||||
|
||||
|
||||
|
||||
## Location
|
||||
|
||||
- `from aiogram.types import PollAnswer`
|
||||
- `from aiogram.api.types import PollAnswer`
|
||||
- `from aiogram.api.types.poll_answer import PollAnswer`
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#pollanswer)
|
||||
- [aiogram.types.User](../types/user.md)
|
||||
|
|
@ -22,6 +22,7 @@ At most one of the optional parameters can be present in any given update.
|
|||
| `shipping_query` | `#!python Optional[ShippingQuery]` | Optional. New incoming shipping query. Only for invoices with flexible price |
|
||||
| `pre_checkout_query` | `#!python Optional[PreCheckoutQuery]` | Optional. New incoming pre-checkout query. Contains full information about checkout |
|
||||
| `poll` | `#!python Optional[Poll]` | Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot |
|
||||
| `poll_answer` | `#!python Optional[PollAnswer]` | Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. |
|
||||
|
||||
|
||||
|
||||
|
|
@ -39,5 +40,6 @@ At most one of the optional parameters can be present in any given update.
|
|||
- [aiogram.types.InlineQuery](../types/inline_query.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.Poll](../types/poll.md)
|
||||
- [aiogram.types.PollAnswer](../types/poll_answer.md)
|
||||
- [aiogram.types.PreCheckoutQuery](../types/pre_checkout_query.md)
|
||||
- [aiogram.types.ShippingQuery](../types/shipping_query.md)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ This object represents a Telegram user or bot.
|
|||
| `last_name` | `#!python Optional[str]` | Optional. User‘s or bot’s last name |
|
||||
| `username` | `#!python Optional[str]` | Optional. User‘s or bot’s username |
|
||||
| `language_code` | `#!python Optional[str]` | Optional. IETF language tag of the user's language |
|
||||
| `can_join_groups` | `#!python Optional[bool]` | Optional. True, if the bot can be invited to groups. Returned only in getMe. |
|
||||
| `can_read_all_group_messages` | `#!python Optional[bool]` | Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. |
|
||||
| `supports_inline_queries` | `#!python Optional[bool]` | Optional. True, if the bot supports inline queries. Returned only in getMe. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue