mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Bot API 5.0 (#454)
* increased Telegram Bot API version * AIOG-T-64 added logOut method * AIOG-T-64 added logOut method test * AIOG-T-64 logOut type annotation fix * AIOG-T-65 added close (close_bot) method * AIOG-T-65 old `close` method deprecation warn * AIOG-T-65 `close_bot` test added * AIOG-T-67 added ip_address param to set_webhook, updated docs * updated deprecation text Co-authored-by: Martin Winks <mpa@snejugal.ru> * AIOG-T-69 param `drop_pending_updates` added in methods `setWebhook` and `deleteWebhook` * AIOG-T-71 new `ChatLocation` class * AIOG-T-70 updated `Chat` class: bio, linked chats, location * AIOG-T-68 field `ip_address` added to class `WebhookInfo` * AIOG-T-72 param `only_if_banned` added to `unbanChatMember` method * AIOG-T-72 updated Chat.unban shortcut * AIOG-T-73 field `file_name` added to `Audio` and `Video` classes * AIOG-T-74 param `disable_content_type_detection` added in `sendDocument` method and `InputMediaDocument` class * AIOG-T-75 Added the ability to pin messages in private chats (docs update) * AIOG-T-76 Added the parameter message_id to the method unpinChatMessage to allow unpinning of the specific pinned message * AIOG-T-77 Added the method unpinAllChatMessages, which can be used to unpin all pinned messages in a chat. * AIOG-T-78 updated send_media_group description; added media qty check * AIOG-T-80 field `live_period` added to `Location` class * AIOG-T-81 Added support for live location heading * AIOG-T-82 added the field proximity_alert_distance to the classes Location, InlineQueryResultLocation, InputLocationMessageContent; fixed heading in InputLocationMessageContent * AIOG-T-82 added parameter proximity_alert_distance to the methods sendLocation and editMessageLiveLocation * AIOG-T-83 Added the type ProximityAlertTriggered * AIOG-T-83 Added field proximity_alert_triggered to the class Message * AIOG-T-84 Added the field horizontal_accuracy to the classes Location, InlineQueryResultLocation, InputLocationMessageContent * AIOG-T-84 Added the parameter horizontal_accuracy to the methods sendLocation and editMessageLiveLocation. * Added live_period to InputLocationMessageContent (missed?) * AIOG-T-85 Added the field sender_chat to the class Message * AIOG-T-86 Added `is_anonymous` field to `chatMember` class * AIOG-T-87 Added the parameter is_anonymous to the method promoteChatMember * AIOG-T-89 Added the method `copyMessage` * AIOG-T-90 Poll docs update * AIOG-T-91 ability to manually specify text entities * AIOG-T-92 Google Places as a venue API provider * AIOG-T-93 Added the field allow_sending_without_reply to the methods * AIOG-T-94 football and slot machine dice * removed Optional Co-authored-by: Ramzan Bekbulatov <bekbulatov.ramzan@ya.ru> * Apply suggestions from code review removed Optional Co-authored-by: Ramzan Bekbulatov <bekbulatov.ramzan@ya.ru> * Don't use deprecated Bot.close method from dispatcher (Replaced by session.close) * Fix copyMessage method, update alias (with deprecation) Fix imports * AIOG-T-79: Easy way to use custom API server * Update docs * Bump requirements * Rollback email * AIOG-T-93 allow_sending_without_reply to send_message shortcuts * AIOG-T-93 added allow_sending_without_reply to send_photo shortcuts * AIOG-T-93 added allow_sending_without_reply to send_video shortcuts * Union[type, None] -> Optional[type] refactoring * AIOG-T-93 added allow_sending_without_reply to send_animation shortcuts * added type hint to reply field * AIOG-T-93 added allow_sending_without_reply to send_audio shortcuts * AIOG-T-93 added allow_sending_without_reply to send_document shortcuts * AIOG-T-93 added allow_sending_without_reply to send_sticker shortcuts * AIOG-T-93 added allow_sending_without_reply to send_video_note shortcuts * AIOG-T-93 added allow_sending_without_reply to send_voice shortcuts * AIOG-T-93 added allow_sending_without_reply to send_location shortcuts * AIOG-T-93 added allow_sending_without_reply to send_venue shortcuts * AIOG-T-93 added allow_sending_without_reply to send_contact shortcuts * AIOG-T-93 added allow_sending_without_reply to send_poll shortcuts * AIOG-T-93 added allow_sending_without_reply to send_dice shortcuts * AIOG-T-93 added allow_sending_without_reply to send_media_group shortcuts * AIOG-T-92 added google_place_ to send_venue shortcuts * AIOG-T-91 added entities to send_message shortcuts * AIOG-T-91 added caption_entities to send_photo shortcuts * AIOG-T-91 added caption_entities to send_video shortcuts * AIOG-T-91 added caption_entities to send_animation shortcuts * AIOG-T-91 added caption_entities to send_audio shortcuts * AIOG-T-91 added caption_entities to send_document shortcuts * AIOG-T-91 added caption_entities to send_voice shortcuts * AIOG-T-91 added explanation_parse_mode to send_poll shortcuts * AIOG-T-91 added entities to edit_message_text shortcuts * AIOG-T-91 added caption_entities to edit_message_caption shortcuts * fixed types.MessageEntity -> MessageEntity in docs Co-authored-by: Martin Winks <mpa@snejugal.ru> Co-authored-by: Ramzan Bekbulatov <bekbulatov.ramzan@ya.ru> Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
This commit is contained in:
parent
8c43c209e0
commit
2b060d9ad4
49 changed files with 2847 additions and 1194 deletions
|
|
@ -1,28 +1,8 @@
|
|||
.. Autogenerated file at 2018-10-28 19:31:48.335963
|
||||
|
||||
=========================
|
||||
Advanced executor example
|
||||
=========================
|
||||
|
||||
!/usr/bin/env python3
|
||||
**This example is outdated**
|
||||
In this example used ArgumentParser for configuring Your bot.
|
||||
Provided to start bot with webhook:
|
||||
python advanced_executor_example.py \
|
||||
--token TOKEN_HERE \
|
||||
--host 0.0.0.0 \
|
||||
--port 8084 \
|
||||
--host-name example.com \
|
||||
--webhook-port 443
|
||||
Or long polling:
|
||||
python advanced_executor_example.py --token TOKEN_HERE
|
||||
So... In this example found small trouble:
|
||||
can't get bot instance in handlers.
|
||||
If you want to automatic change getting updates method use executor utils (from aiogram.utils.executor)
|
||||
TODO: Move token to environment variables.
|
||||
|
||||
.. literalinclude:: ../../../examples/advanced_executor_example.py
|
||||
:caption: advanced_executor_example.py
|
||||
:language: python
|
||||
:linenos:
|
||||
:lines: 25-
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.593501
|
||||
|
||||
=================
|
||||
Broadcast example
|
||||
=================
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.558059
|
||||
|
||||
===================
|
||||
Check user language
|
||||
===================
|
||||
|
|
@ -10,4 +8,3 @@ Babel is required.
|
|||
:caption: check_user_language.py
|
||||
:language: python
|
||||
:linenos:
|
||||
:lines: 5-
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
========
|
||||
Echo bot
|
||||
========
|
||||
|
||||
Very simple example of the bot which will sent text of the received messages to the sender
|
||||
|
||||
.. literalinclude:: ../../../examples/echo_bot.py
|
||||
:caption: echo_bot.py
|
||||
:language: python
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.595032
|
||||
|
||||
============================
|
||||
Finite state machine example
|
||||
============================
|
||||
|
|
|
|||
|
|
@ -1,28 +1,8 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.591007
|
||||
|
||||
============
|
||||
I18n example
|
||||
============
|
||||
|
||||
Internalize your bot
|
||||
Step 1: extract texts
|
||||
# pybabel extract i18n_example.py -o locales/mybot.pot
|
||||
Step 2: create *.po files. For e.g. create en, ru, uk locales.
|
||||
# echo {en,ru,uk} | xargs -n1 pybabel init -i locales/mybot.pot -d locales -D mybot -l
|
||||
Step 3: translate texts
|
||||
Step 4: compile translations
|
||||
# pybabel compile -d locales -D mybot
|
||||
Step 5: When you change the code of your bot you need to update po & mo files.
|
||||
Step 5.1: regenerate pot file:
|
||||
command from step 1
|
||||
Step 5.2: update po files
|
||||
# pybabel update -d locales -D mybot -i locales/mybot.pot
|
||||
Step 5.3: update your translations
|
||||
Step 5.4: compile mo files
|
||||
command from step 4
|
||||
|
||||
.. literalinclude:: ../../../examples/i18n_example.py
|
||||
:caption: i18n_example.py
|
||||
:language: python
|
||||
:linenos:
|
||||
:lines: 22-
|
||||
|
|
|
|||
|
|
@ -19,3 +19,4 @@ Examples
|
|||
payments
|
||||
broadcast_example
|
||||
media_group
|
||||
local_server
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.561907
|
||||
|
||||
==========
|
||||
Inline bot
|
||||
==========
|
||||
|
|
|
|||
8
docs/source/examples/local_server.rst
Normal file
8
docs/source/examples/local_server.rst
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
============
|
||||
Local server
|
||||
============
|
||||
|
||||
.. literalinclude:: ../../../examples/local_server.py
|
||||
:caption: local_server.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.566615
|
||||
|
||||
===========
|
||||
Media group
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.560132
|
||||
|
||||
========================
|
||||
Middleware and antiflood
|
||||
========================
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.579017
|
||||
|
||||
========
|
||||
Payments
|
||||
========
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.555359
|
||||
|
||||
=================
|
||||
Proxy and emojize
|
||||
=================
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.568530
|
||||
|
||||
==============================
|
||||
Regexp commands filter example
|
||||
==============================
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.563878
|
||||
|
||||
=================
|
||||
Throtling example
|
||||
=================
|
||||
|
||||
Example for throttling manager.
|
||||
You can use that for flood controlling.
|
||||
==================
|
||||
Throttling example
|
||||
==================
|
||||
|
||||
.. literalinclude:: ../../../examples/throttling_example.py
|
||||
:caption: throttling_example.py
|
||||
:language: python
|
||||
:linenos:
|
||||
:lines: 7-
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
.. Autogenerated file at 2018-10-28 19:31:48.341172
|
||||
|
||||
===============
|
||||
Webhook example
|
||||
===============
|
||||
|
||||
Example outdated
|
||||
|
||||
.. literalinclude:: ../../../examples/webhook_example.py
|
||||
:caption: webhook_example.py
|
||||
:language: python
|
||||
:linenos:
|
||||
:lines: 5-
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
.. Autogenerated file at 2018-09-08 02:07:37.576034
|
||||
|
||||
===================
|
||||
Webhook example old
|
||||
===================
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Welcome to aiogram's documentation!
|
|||
:target: https://pypi.python.org/pypi/aiogram
|
||||
:alt: Supported python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.9-blue.svg?style=flat-square&logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-5.0-blue.svg?style=flat-square&logo=telegram
|
||||
:target: https://core.telegram.org/bots/api
|
||||
:alt: Telegram Bot API
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue