Edited comments & titles

This commit is contained in:
nullmatawasoradesu 2023-08-10 23:43:31 +03:00
parent 720d192258
commit ce989cbee0
2 changed files with 8 additions and 8 deletions

View file

@ -16,17 +16,17 @@ class HelloFilter(Filter):
self,
message: Message,
event_from_user: User
# as I said previously, filters also can accept keyword parameters like in handlers
# Filters also can accept keyword parameters like in handlers
) -> Union[bool, Dict[str, Any]]:
if message.text.casefold() == "hello":
# returning a dictionary that will update the context data
# Returning a dictionary that will update the context data
return {"name": event_from_user.mention_html(name=self.name)}
return False
@router.message(HelloFilter(name=None))
@router.message(HelloFilter())
async def my_handler(
message: Message, name: str # and now we can accept "name" as named parameter
message: Message, name: str # Now we can accept "name" as named parameter
) -> Any:
return message.answer(
"Hello, {name}!".format(name=name)