mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
Updated pre-commit hook (#681)
* Updated pre-commit config and reformat code * Added changelog
This commit is contained in:
parent
90b3a99039
commit
e356ede5de
20 changed files with 74 additions and 62 deletions
2
docs/_static/stylesheets/extra.css
vendored
2
docs/_static/stylesheets/extra.css
vendored
|
|
@ -19,4 +19,4 @@ code, kbd, pre {
|
|||
.highlight * {
|
||||
background: #424242;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ For example :code:`sendMessage` named :code:`send_message` and has the same spec
|
|||
:show-inheritance:
|
||||
:member-order: bysource
|
||||
:special-members: __init__
|
||||
:undoc-members: True
|
||||
:undoc-members: True
|
||||
|
|
|
|||
|
|
@ -25,4 +25,3 @@ Extension
|
|||
This base handler is subclass of :ref:`BaseHandler <cbh-base-handler>` with some extensions:
|
||||
|
||||
- :code:`self.chat` is alias for :code:`self.event.chat`
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Here is only listed base information about Dispatcher. All about writing handler
|
|||
|
||||
|
||||
.. autoclass:: aiogram.dispatcher.dispatcher.Dispatcher
|
||||
:members: __init__, feed_update, feed_raw_update, feed_webhook_update, start_polling, run_polling
|
||||
:members: __init__, feed_update, feed_raw_update, feed_webhook_update, start_polling, run_polling
|
||||
|
||||
|
||||
Simple usage
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Filtering events
|
|||
================
|
||||
|
||||
Filters is needed for routing updates to the specific handler.
|
||||
Searching of handler is always stops on first match set of filters are pass.
|
||||
Searching of handler is always stops on first match set of filters are pass.
|
||||
|
||||
*aiogram* has some builtin useful filters.
|
||||
|
||||
|
|
@ -39,8 +39,8 @@ Filters can be:
|
|||
|
||||
- Instances of :ref:`MagicFilter <magic-filters>`
|
||||
|
||||
Filters should return bool or dict.
|
||||
If the dictionary is passed as result of filter - resulted data will be propagated to the next
|
||||
Filters should return bool or dict.
|
||||
If the dictionary is passed as result of filter - resulted data will be propagated to the next
|
||||
filters and handler as keywords arguments.
|
||||
|
||||
Writing bound filters
|
||||
|
|
@ -72,7 +72,6 @@ For example if you need to make simple text filter:
|
|||
|
||||
.. note::
|
||||
|
||||
Bound filters is always recursive propagates to the nested routers but will be available
|
||||
Bound filters is always recursive propagates to the nested routers but will be available
|
||||
in nested routers only after attaching routers so that's mean you will need to
|
||||
include routers before registering handlers.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Handling events
|
||||
===============
|
||||
|
||||
*aiogram* imcludes Dispatcher mechanism.
|
||||
*aiogram* imcludes Dispatcher mechanism.
|
||||
Dispatcher is needed for handling incoming updates from Telegram.
|
||||
|
||||
With dispatcher you can do:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Observer is used for filtering and handling different events. That is part of in
|
|||
|
||||
In `aiogram` framework is available two variants of observer:
|
||||
|
||||
- `EventObserver <#eventobserver>`__
|
||||
- `EventObserver <#eventobserver>`__
|
||||
- `TelegramEventObserver <#telegrameventobserver>`__
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Event observers
|
|||
.. warning::
|
||||
|
||||
All handlers is always should be an asynchronous.
|
||||
Name of handler function is not important. Event argument name is also is not important but is recommended to don't overlap the name with contextual data in due to function can not accept two arguments with the same name.
|
||||
Name of handler function is not important. Event argument name is also is not important but is recommended to don't overlap the name with contextual data in due to function can not accept two arguments with the same name.
|
||||
|
||||
Here is list of available observers and examples how to register handlers (In examples used only @decorator-style):
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ Update
|
|||
------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
@router.update()
|
||||
async def message_handler(update: types.Update) -> Any: pass
|
||||
|
||||
|
|
@ -39,8 +39,8 @@ Message
|
|||
.. attention::
|
||||
|
||||
Be attentive with filtering this event
|
||||
|
||||
You should expect than this event can be with different set's of attributes in different cases
|
||||
|
||||
You should expect than this event can be with different set's of attributes in different cases
|
||||
|
||||
(For example text, sticker and document is always is different content types of message)
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ Nested routers
|
|||
.. warning::
|
||||
|
||||
Routers by the way can be nested to an another routers with some limitations:
|
||||
|
||||
|
||||
1. Router **CAN NOT** include itself
|
||||
1. Routers **CAN NOT** be used for circular including (router 1 include router 2, router 2 include router 3, router 3 include router 1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue