mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 16:15:51 +00:00
* Rewrite filters * Update README.rst * Fixed tests * Small optimization of the Text filter (TY to @bomzheg) * Remove dataclass slots argument in due to the only Python 3.10 has an slots argument * Fixed mypy * Update tests * Disable Python 3.11 * Fixed #1013: Empty mention should be None instead of empty string. * Added #990 to the changelog * Added #942 to the changelog * Fixed coverage * Update poetry and dependencies * Fixed mypy * Remove deprecated code * Added more tests, update pyproject.toml * Partial update docs * Added initial Docs translation files * Added more changes * Added log message when connection is established in polling process * Fixed action * Disable lint for PyPy * Added changelog for docs translation
18 lines
404 B
Python
18 lines
404 B
Python
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):
|
|
...
|