A problem raised when we are working on Dall-E feature: We need the bot to enter a dialogue mode where the bot ask questions, and users can reply back to continue the painting. The current dispatcher will literally not support this operation, because the handlers are performed one-by-one in registration order. Registering DallE module earlier than Chat module seems to solve our problem, but that would just be a workaround.
The common usage of the bot is chatting, it's the default mode. However, sometimes, some other modules may want to respond to a message with higher priority temporarily. This is where Conversation comes in. It's similar to Dialogue in teloxide, but instead of single-typed state, we support multiple-typed state, and each type of state can provide different handlers. Back to the problem we issued before. When user want to use Dall-E, it can type let's say /paint, then the bot will enter a Dall-E painting conversation. User can answer the questions asked by bot in the conversation without being intercepted by Chat module. This is implemented by a handler ahead of regular module handlers.
As we are doing the refactor, we also refined how commands are handled. In the current implementation, command providing and handling are separated, which is not that scalable and maintainable. In the next version, it will also be unified.
Here is a overview of how updates are processed in the new dispatching pipeline:
A problem raised when we are working on Dall-E feature: We need the bot to enter a dialogue mode where the bot ask questions, and users can reply back to continue the painting. The current dispatcher will literally not support this operation, because the handlers are performed one-by-one in registration order. Registering
DallE
module earlier thanChat
module seems to solve our problem, but that would just be a workaround.The common usage of the bot is chatting, it's the default mode. However, sometimes, some other modules may want to respond to a message with higher priority temporarily. This is where
Conversation
comes in. It's similar toDialogue
in teloxide, but instead of single-typed state, we support multiple-typed state, and each type of state can provide different handlers. Back to the problem we issued before. When user want to use Dall-E, it can type let's say/paint
, then the bot will enter a Dall-E painting conversation. User can answer the questions asked by bot in the conversation without being intercepted byChat
module. This is implemented by a handler ahead of regular module handlers.As we are doing the refactor, we also refined how commands are handled. In the current implementation, command providing and handling are separated, which is not that scalable and maintainable. In the next version, it will also be unified.
Here is a overview of how updates are processed in the new dispatching pipeline: