Disabled ContentTypesFilter by default (#668)

* Disabled ContentTypesFilter by default

* Rename file

* Update docs
This commit is contained in:
Alex Root Junior 2021-08-20 02:39:03 +03:00 committed by GitHub
parent 5851e32266
commit 18a93aab60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 18 deletions

View file

@ -15,11 +15,6 @@ Can be imported:
Or used from filters factory by passing corresponding arguments to handler registration line
.. warning::
**Please be patient!**
If no one content type filter is specified the :code:`["text"]` value is automatically will be used.
Usage
=====

View file

@ -37,6 +37,8 @@ Filters can be:
- Subclass of :ref:`BaseFilter <filters-base>`
- 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 and handler as keywords arguments.
@ -70,4 +72,7 @@ For example if you need to make simple text filter:
.. note::
Bound filters is always recursive propagates to the nested routers.
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.

View file

@ -35,6 +35,19 @@ Update
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
(For example text, sticker and document is always is different content types of message)
Recommended way to check field availability before usage or use
:class:`aiogram.dispatcher.filters.content_types.ContentTypesFilter`
.. code-block:: python
@router.message()