Key for custom filters

This commit is contained in:
coder2020official 2022-05-01 16:11:00 +05:00
parent 7d9658b062
commit 76c0197ab7
2 changed files with 16 additions and 0 deletions

View File

@ -10,8 +10,12 @@ class SimpleCustomFilter(ABC):
Simple Custom Filter base class.
Create child class with check() method.
Accepts only message, returns bool value, that is compared with given in handler.
Child classes should have .key property.
"""
key: str = None
async def check(self, message):
"""
Perform a check.
@ -26,8 +30,12 @@ class AdvancedCustomFilter(ABC):
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
message: Message class
text: Filter value given in handler
Child classes should have .key property.
"""
key: str = None
async def check(self, message, text):
"""
Perform a check.

View File

@ -12,8 +12,12 @@ class SimpleCustomFilter(ABC):
Simple Custom Filter base class.
Create child class with check() method.
Accepts only message, returns bool value, that is compared with given in handler.
Child classes should have .key property.
"""
key: str = None
def check(self, message):
"""
Perform a check.
@ -28,8 +32,12 @@ class AdvancedCustomFilter(ABC):
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
message: Message class
text: Filter value given in handler
Child classes should have .key property.
"""
key: str = None
def check(self, message, text):
"""
Perform a check.