mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Removed Text filter (#1170)
* Removed Text filter * Added changelog * Clean docs * Fixed pytz
This commit is contained in:
parent
dad3cdc409
commit
62a9f0cb6e
9 changed files with 13 additions and 581 deletions
|
|
@ -16,7 +16,6 @@ Here is list of builtin filters:
|
|||
:maxdepth: 1
|
||||
|
||||
command
|
||||
text
|
||||
chat_member_updated
|
||||
magic_filters
|
||||
magic_data
|
||||
|
|
@ -69,7 +68,7 @@ If you specify multiple filters in a row, it will be checked with an "and" condi
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
@<router>.message(Text(startswith="show"), Text(endswith="example"))
|
||||
@<router>.message(F.text.startswith("show"), F.text.endswith("example"))
|
||||
|
||||
|
||||
Also, if you want to use two alternative ways to run the same handler ("or" condition)
|
||||
|
|
@ -77,7 +76,7 @@ you can register the handler twice or more times as you like
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
@<router>.message(Text(text="hi"))
|
||||
@<router>.message(F.text == "hi")
|
||||
@<router>.message(CommandStart())
|
||||
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ An alternative way is to combine using special functions (:func:`and_f`, :func:`
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
and_f(Text(startswith="show"), Text(endswith="example"))
|
||||
or_f(Text(text="hi"), CommandStart())
|
||||
and_f(F.text.startswith("show"), F.text.endswith("example"))
|
||||
or_f(F.text(text="hi"), CommandStart())
|
||||
invert_f(IsAdmin())
|
||||
and_f(<A>, or_f(<B>, <C>))
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
====
|
||||
Text
|
||||
====
|
||||
|
||||
.. autoclass:: aiogram.filters.text.Text
|
||||
:members:
|
||||
:member-order: bysource
|
||||
:undoc-members: False
|
||||
|
||||
Can be imported:
|
||||
|
||||
- :code:`from aiogram.filters.text import Text`
|
||||
- :code:`from aiogram.filters import Text`
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
#. Text equals with the specified value: :code:`Text(text="text") # value == 'text'`
|
||||
#. Text starts with the specified value: :code:`Text(startswith="text") # value.startswith('text')`
|
||||
#. Text ends with the specified value: :code:`Text(endswith="text") # value.endswith('text')`
|
||||
#. Text contains the specified value: :code:`Text(contains="text") # value in 'text'`
|
||||
#. Any of previous listed filters can be list, set or tuple of strings that's mean any of listed value should be equals/startswith/endswith/contains: :code:`Text(text=["text", "spam"])`
|
||||
#. Ignore case can be combined with any previous listed filter: :code:`Text(text="Text", ignore_case=True) # value.lower() == 'text'.lower()`
|
||||
|
||||
Allowed handlers
|
||||
================
|
||||
|
||||
Allowed update types for this filter:
|
||||
|
||||
- :code:`message`
|
||||
- :code:`edited_message`
|
||||
- :code:`channel_post`
|
||||
- :code:`edited_channel_post`
|
||||
- :code:`inline_query`
|
||||
- :code:`callback_query`
|
||||
Loading…
Add table
Add a link
Reference in a new issue