mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Disabled ContentTypesFilter by default (#668)
* Disabled ContentTypesFilter by default * Rename file * Update docs
This commit is contained in:
parent
5851e32266
commit
18a93aab60
6 changed files with 21 additions and 18 deletions
|
|
@ -11,10 +11,9 @@ from .base import BaseFilter
|
|||
class ContentTypesFilter(BaseFilter):
|
||||
"""
|
||||
Is useful for handling specific types of messages (For example separate text and stickers handlers).
|
||||
This is always automatically adds to the filters list for message handlers.
|
||||
"""
|
||||
|
||||
content_types: Optional[Union[Sequence[str], str]] = None
|
||||
content_types: Union[Sequence[str], str]
|
||||
"""Sequence of allowed content types"""
|
||||
|
||||
@validator("content_types")
|
||||
|
|
@ -32,7 +31,4 @@ class ContentTypesFilter(BaseFilter):
|
|||
return value
|
||||
|
||||
async def __call__(self, message: Message) -> Union[bool, Dict[str, Any]]:
|
||||
if not self.content_types: # pragma: no cover
|
||||
# Is impossible but needed for valid typechecking
|
||||
self.content_types = [ContentType.TEXT]
|
||||
return ContentType.ANY in self.content_types or message.content_type in self.content_types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue