mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Partial update docs
This commit is contained in:
parent
d9f9ff74fe
commit
4db765f3a7
17 changed files with 81 additions and 123 deletions
18
examples/own_filter.py
Normal file
18
examples/own_filter.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from aiogram import Router
|
||||
from aiogram.filters import Filter
|
||||
from aiogram.types import Message
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
class MyFilter(Filter):
|
||||
def __init__(self, my_text: str) -> None:
|
||||
self.my_text = my_text
|
||||
|
||||
async def __call__(self, message: Message) -> bool:
|
||||
return message.text == self.my_text
|
||||
|
||||
|
||||
@router.message(MyFilter("hello"))
|
||||
async def my_handler(message: Message):
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue