Implemented hashtag/cashtag filter

This commit is contained in:
Alex Root Junior 2018-09-28 03:40:10 +03:00
parent 09293063d3
commit 0185af25c1
3 changed files with 74 additions and 4 deletions

View file

@ -6,9 +6,8 @@ import time
import typing
from contextvars import ContextVar
from aiogram.dispatcher.filters import Command
from .filters import ContentTypeFilter, ExceptionsFilter, FiltersFactory, RegexpCommandsFilter, \
Regexp, StateFilter, Text
from .filters import Command, ContentTypeFilter, ExceptionsFilter, FiltersFactory, HashTag, Regexp, \
RegexpCommandsFilter, StateFilter, Text
from .handler import Handler
from .middlewares import MiddlewareManager
from .storage import BaseStorage, DELTA, DisabledStorage, EXCEEDED_COUNT, FSMContext, \
@ -93,6 +92,10 @@ class Dispatcher:
self.channel_post_handlers, self.edited_channel_post_handlers,
self.callback_query_handlers
])
filters_factory.bind(HashTag, event_handlers=[
self.message_handlers, self.edited_message_handlers,
self.channel_post_handlers, self.edited_channel_post_handlers
])
filters_factory.bind(Regexp, event_handlers=[
self.message_handlers, self.edited_message_handlers,
self.channel_post_handlers, self.edited_channel_post_handlers,