mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Remove func filter
This commit is contained in:
parent
65a1659345
commit
7236541723
3 changed files with 2 additions and 22 deletions
|
|
@ -8,7 +8,7 @@ import typing
|
|||
import aiohttp
|
||||
from aiohttp.helpers import sentinel
|
||||
|
||||
from .filters import Command, ContentTypeFilter, ExceptionsFilter, FiltersFactory, FuncFilter, HashTag, Regexp, \
|
||||
from .filters import Command, ContentTypeFilter, ExceptionsFilter, FiltersFactory, HashTag, Regexp, \
|
||||
RegexpCommandsFilter, StateFilter, Text
|
||||
from .handler import Handler
|
||||
from .middlewares import MiddlewareManager
|
||||
|
|
@ -114,9 +114,6 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
filters_factory.bind(ExceptionsFilter, event_handlers=[
|
||||
self.errors_handlers
|
||||
])
|
||||
filters_factory.bind(FuncFilter, exclude_event_handlers=[
|
||||
self.errors_handlers
|
||||
])
|
||||
|
||||
def __del__(self):
|
||||
self.stop_polling()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from .builtin import Command, CommandHelp, CommandPrivacy, CommandSettings, CommandStart, ContentTypeFilter, \
|
||||
ExceptionsFilter, FuncFilter, HashTag, Regexp, RegexpCommandsFilter, StateFilter, Text
|
||||
ExceptionsFilter, HashTag, Regexp, RegexpCommandsFilter, StateFilter, Text
|
||||
from .factory import FiltersFactory
|
||||
from .filters import AbstractFilter, BoundFilter, Filter, FilterNotPassed, FilterRecord, execute_filter, \
|
||||
check_filters, get_filter_spec, get_filters_spec
|
||||
|
|
@ -15,7 +15,6 @@ __all__ = [
|
|||
'ContentTypeFilter',
|
||||
'ExceptionsFilter',
|
||||
'HashTag',
|
||||
'FuncFilter',
|
||||
'Filter',
|
||||
'FilterNotPassed',
|
||||
'FilterRecord',
|
||||
|
|
|
|||
|
|
@ -398,22 +398,6 @@ class StateFilter(BoundFilter):
|
|||
return False
|
||||
|
||||
|
||||
class FuncFilter(BoundFilter):
|
||||
key = 'func'
|
||||
|
||||
def __init__(self, dispatcher, func):
|
||||
self.dispatcher = dispatcher
|
||||
self.func = func
|
||||
|
||||
warn_deprecated('"func" filter will be removed in 2.1 version.\n'
|
||||
'Read mode: https://aiogram.readthedocs.io/en/dev-2.x/migration_1_to_2.html#custom-filters',
|
||||
stacklevel=8)
|
||||
|
||||
async def check(self, obj) -> bool:
|
||||
from .filters import check_filter
|
||||
return await check_filter(self.dispatcher, self.func, (obj,))
|
||||
|
||||
|
||||
class ExceptionsFilter(BoundFilter):
|
||||
"""
|
||||
Filter for exceptions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue