|
|
@@ -26,15 +26,13 @@ class TextRouter(Router):
|
|
|
self.event_handler = event_handler
|
|
|
self.executor = moderation_executor
|
|
|
|
|
|
- self._register_handlers()
|
|
|
-
|
|
|
- def _register_handlers(self):
|
|
|
+ def setup(self):
|
|
|
@self.message(F.text)
|
|
|
async def on_text(message: Message):
|
|
|
|
|
|
_ = self.translator.get()
|
|
|
|
|
|
- moderation = self.config.moderation.enabled and isinstance(self.executor, ModerationExecutor)
|
|
|
+ moderation = self.config.moderation.enabled
|
|
|
moderation_passed = not moderation
|
|
|
|
|
|
if (
|
|
|
@@ -42,8 +40,7 @@ class TextRouter(Router):
|
|
|
and "text" in self.config.forwarding.types
|
|
|
):
|
|
|
if moderation:
|
|
|
- assert self.executor is not None
|
|
|
- async for event in self.executor.process_message(message):
|
|
|
+ async for event in self.executor.process_message(message): # type: ignore
|
|
|
if isinstance(event, ModerationDecisionEvent):
|
|
|
moderation_passed = event.approved
|
|
|
await self.event_handler.handle(event, message)
|