Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Filters documentation #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The following wonderful people contributed directly or indirectly to this projec
- `Eugene Lisitsky <https://github.com/lisitsky>`_
- `franciscod <https://github.com/franciscod>`_
- `Hugo Damer <https://github.com/HakimusGIT>`_
- `Iulian Onofrei <https://github.com/revolter>`_
- `Jacob Bom <https://github.com/bomjacob>`_
- `JASON0916 <https://github.com/JASON0916>`_
- `jh0ker <https://github.com/jh0ker>`_
Expand Down
8 changes: 6 additions & 2 deletions telegram/ext/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BaseFilter(object):

And:

>>> (Filters.text & Filters.entity(MENTION))
>>> (Filters.text & Filters.entity(MessageEntity.MENTION))

Or:

Expand All @@ -38,7 +38,11 @@ class BaseFilter(object):

Also works with more than two filters:

>>> (Filters.text & (Filters.entity(URL) | Filters.entity(TEXT_LINK)))
>>> (
... Filters.text & (
... Filters.entity(MessageEntity.URL) | Filters.entity(MessageEntity.TEXT_LINK)
... )
... )
>>> Filters.text & (~ Filters.forwarded)

If you want to create your own filters create a class inheriting from this class and implement
Expand Down