For a Telegram bot that manages chats, I need to be able to:
- handle any "common" messages to the chat to perform some moderation;
- if the message also happens to be a command, then run the corresponding command handler.
Not running chat_handler for command invocations is not an option because it enables malicious actors to hide bad messages under command prefixes.
Is it currently possible to achieve this with dptree? I thought of using filter_async, which would have an added benefit of not running command handlers at all if the message was deleted, but it appears that I would need something like try_filter_async (#26) for proper error handling (Telegram API, database). Also, it this existed, would Teloxide be able to pass errors from the fallible filter to Dispatcher's error_handler?
For a Telegram bot that manages chats, I need to be able to:
Not running
chat_handlerfor command invocations is not an option because it enables malicious actors to hide bad messages under command prefixes.Is it currently possible to achieve this with
dptree? I thought of usingfilter_async, which would have an added benefit of not running command handlers at all if the message was deleted, but it appears that I would need something liketry_filter_async(#26) for proper error handling (Telegram API, database). Also, it this existed, would Teloxide be able to pass errors from the fallible filter toDispatcher'serror_handler?