fix: exclude commands from message handler, remove bad register call
This commit is contained in:
parent
763eba2817
commit
5bbd336f58
2 changed files with 2 additions and 3 deletions
|
|
@ -53,7 +53,6 @@ def build_event_dispatcher(platform: MockPlatformClient) -> EventDispatcher:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register core handlers
|
# Register core handlers
|
||||||
ed.register(type(None).__mro__[0], "start", handle_start) # placeholder
|
|
||||||
from core.protocol import IncomingCommand, IncomingMessage, IncomingCallback
|
from core.protocol import IncomingCommand, IncomingMessage, IncomingCallback
|
||||||
ed.register(IncomingCommand, "start", handle_start)
|
ed.register(IncomingCommand, "start", handle_start)
|
||||||
ed.register(IncomingCommand, "settings", handle_settings)
|
ed.register(IncomingCommand, "settings", handle_settings)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from aiogram import F, Router
|
from aiogram import F, Router
|
||||||
from aiogram.filters import Command
|
from aiogram.filters import Command, CommandObject
|
||||||
from aiogram.fsm.context import FSMContext
|
from aiogram.fsm.context import FSMContext
|
||||||
from aiogram.types import CallbackQuery, Message
|
from aiogram.types import CallbackQuery, Message
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ async def _send_outgoing(message: Message, chat_name: str, events: list) -> None
|
||||||
await message.answer(format_outgoing(chat_name, event))
|
await message.answer(format_outgoing(chat_name, event))
|
||||||
|
|
||||||
|
|
||||||
@router.message(ChatState.idle, F.text | F.photo | F.document | F.voice)
|
@router.message(ChatState.idle, (F.text | F.photo | F.document | F.voice) & ~F.text.startswith("/"))
|
||||||
async def handle_message(
|
async def handle_message(
|
||||||
message: Message,
|
message: Message,
|
||||||
state: FSMContext,
|
state: FSMContext,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue