mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Key for custom filters
This commit is contained in:
parent
7d9658b062
commit
76c0197ab7
@ -10,8 +10,12 @@ class SimpleCustomFilter(ABC):
|
|||||||
Simple Custom Filter base class.
|
Simple Custom Filter base class.
|
||||||
Create child class with check() method.
|
Create child class with check() method.
|
||||||
Accepts only message, returns bool value, that is compared with given in handler.
|
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):
|
async def check(self, message):
|
||||||
"""
|
"""
|
||||||
Perform a check.
|
Perform a check.
|
||||||
@ -26,8 +30,12 @@ class AdvancedCustomFilter(ABC):
|
|||||||
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
|
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
|
||||||
message: Message class
|
message: Message class
|
||||||
text: Filter value given in handler
|
text: Filter value given in handler
|
||||||
|
|
||||||
|
Child classes should have .key property.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
key: str = None
|
||||||
|
|
||||||
async def check(self, message, text):
|
async def check(self, message, text):
|
||||||
"""
|
"""
|
||||||
Perform a check.
|
Perform a check.
|
||||||
|
@ -12,8 +12,12 @@ class SimpleCustomFilter(ABC):
|
|||||||
Simple Custom Filter base class.
|
Simple Custom Filter base class.
|
||||||
Create child class with check() method.
|
Create child class with check() method.
|
||||||
Accepts only message, returns bool value, that is compared with given in handler.
|
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):
|
def check(self, message):
|
||||||
"""
|
"""
|
||||||
Perform a check.
|
Perform a check.
|
||||||
@ -28,8 +32,12 @@ class AdvancedCustomFilter(ABC):
|
|||||||
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
|
Accepts two parameters, returns bool: True - filter passed, False - filter failed.
|
||||||
message: Message class
|
message: Message class
|
||||||
text: Filter value given in handler
|
text: Filter value given in handler
|
||||||
|
|
||||||
|
Child classes should have .key property.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
key: str = None
|
||||||
|
|
||||||
def check(self, message, text):
|
def check(self, message, text):
|
||||||
"""
|
"""
|
||||||
Perform a check.
|
Perform a check.
|
||||||
|
Loading…
Reference in New Issue
Block a user