mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Extended MagicFilter with aiogram-specific operation (#759)
* Extend MagicFilter with aiogram-specific operation * Added tests * Added changes annotation and update docs
This commit is contained in:
parent
092b3f06f2
commit
d7be55bc58
7 changed files with 85 additions and 11 deletions
13
CHANGES/759.feature
Normal file
13
CHANGES/759.feature
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Added new custom operation for MagicFilter named :code:`as_`
|
||||
|
||||
Now you can use it to get magic filter result as handler argument
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from aiogram import F
|
||||
|
||||
...
|
||||
|
||||
@router.message(F.text.regexp(r"^(\d+)$").as_("digits"))
|
||||
async def any_digits_handler(message: Message, digits: Match[str]):
|
||||
await message.answer(html.quote(str(digits)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue