mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Change List to Set
This commit is contained in:
parent
ad4ccac8f7
commit
e2fb9380d6
1 changed files with 4 additions and 4 deletions
|
|
@ -61,8 +61,8 @@ Can be used as method named :code:`in_` or as matmul operator :code:`@` with any
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
F.from_user.id.in_([42, 1000, 123123]) # lambda query: query.from_user.id in [42, 1000, 123123]
|
||||
F.data.in_(['foo', 'bar', 'baz']) # lambda query: query.data in ['foo', 'bar', 'baz']
|
||||
F.from_user.id.in_({42, 1000, 123123}) # lambda query: query.from_user.id in {42, 1000, 123123}
|
||||
F.data.in_({'foo', 'bar', 'baz'}) # lambda query: query.data in {'foo', 'bar', 'baz'}
|
||||
|
||||
Contains
|
||||
--------
|
||||
|
|
@ -116,7 +116,7 @@ All operations can be combined via bitwise and/or operators - :code:`&`/:code:`|
|
|||
|
||||
(F.from_user.id == 42) & (F.text == 'admin')
|
||||
F.text.startswith('a') | F.text.endswith('b')
|
||||
(F.from_user.id.in_([42, 777, 911])) & (F.text.startswith('!') | F.text.startswith('/')) & F.text.contains('ban')
|
||||
(F.from_user.id.in_({42, 777, 911})) & (F.text.startswith('!') | F.text.startswith('/')) & F.text.contains('ban')
|
||||
|
||||
|
||||
Attribute modifiers - string manipulations
|
||||
|
|
@ -156,7 +156,7 @@ Usage in *aiogram*
|
|||
@router.message(F.text == 'hello')
|
||||
@router.inline_query(F.data == 'button:1')
|
||||
@router.message(F.text.startswith('foo'))
|
||||
@router.message(F.content_type.in_(['text', 'sticker']))
|
||||
@router.message(F.content_type.in_({'text', 'sticker'}))
|
||||
@router.message(F.text.regexp(r'\d+'))
|
||||
|
||||
...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue