Clearer Filters docs. Add create to Filters' namespace

This commit is contained in:
Dan 2018-08-19 17:22:28 +02:00
parent 6dfaa3ddea
commit ed05c56f52

View File

@ -31,8 +31,14 @@ def create(name: str, func: callable, **kwargs) -> type:
class Filters: class Filters:
"""This class provides access to all Filters available in Pyrogram. """This class provides access to all library-defined Filters available in Pyrogram.
Filters are intended to be used with the :obj:`MessageHandler <pyrogram.MessageHandler>`."""
The Filters listed here are intended to be used with the :obj:`MessageHandler <pyrogram.MessageHandler>` only.
At the moment, if you want to filter updates coming from different `Handlers <Handlers.html>`_ you have to create
your own filters with :meth:`Filters.create` and use them in the same way.
"""
create = create
bot = create("Bot", lambda _, m: bool(m.from_user and m.from_user.is_bot)) bot = create("Bot", lambda _, m: bool(m.from_user and m.from_user.is_bot))
"""Filter messages coming from bots""" """Filter messages coming from bots"""