mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 17:33:44 +00:00
Use helper for DefaultFilters
This commit is contained in:
parent
cc97fb169f
commit
77d5bac5e4
1 changed files with 9 additions and 5 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from ..utils.helper import Helper, HelperMode, Item
|
||||||
|
|
||||||
|
|
||||||
async def check_filter(filter_, args, kwargs):
|
async def check_filter(filter_, args, kwargs):
|
||||||
if any((inspect.isasyncgen(filter_),
|
if any((inspect.isasyncgen(filter_),
|
||||||
|
|
@ -114,8 +116,10 @@ def generate_default_filters(*args, **kwargs):
|
||||||
return filters_set
|
return filters_set
|
||||||
|
|
||||||
|
|
||||||
class DefaultFilters:
|
class DefaultFilters(Helper):
|
||||||
COMMANDS = 'commands'
|
mode = HelperMode.lower_case
|
||||||
REGEXP = 'regexp'
|
|
||||||
CONTENT_TYPE = 'content_type'
|
COMMANDS = Item() # commands
|
||||||
FUNC = 'func'
|
REGEXP = Item() # regexp
|
||||||
|
CONTENT_TYPE = Item() # content_type
|
||||||
|
FUNC = Item() # func
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue