You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm always frustrated when I have to define conversations using input handlers.
When you are using input handlers, it's pretty hard to write and manage complex conversations.
Describe the solution you'd like
Instead of input handlers, we could use classes for defining conversations. So we are able to write more well-architected code, even when it is complex.
Example:
packagecom.example.blank.conversationimporteu.vendeli.tgbot.TelegramBotimporteu.vendeli.tgbot.api.messageimporteu.vendeli.tgbot.types.Userimporteu.vendeli.tgbot.types.internal.ProcessedUpdatesealedclassGreetingsConversation {
object Start : GreetingsConversation() {
funhandle(update:ProcessedUpdate, user:User, bot:TelegramBot) {
message("Hello, let's move to second step!").send(user, bot)
//set secondStep state//maybe something like
setData(user, "hello" to update.text)
setState(user, GreetingsConversation::start)
}
}
object SecondStep : GreetingsConversation() {
funhandle(update:ProcessedUpdate, user:User, bot:TelegramBot) {
// retrieve data from start step and proceed
message("Nice job! You completed this.").send(user, bot)
deleteState(user, GreetingsConversation)
}
}
}
Additional context
Not sure, if we can do this way.
We discussed about it in Telegram group.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm always frustrated when I have to define conversations using input handlers.
When you are using input handlers, it's pretty hard to write and manage complex conversations.
Describe the solution you'd like
Instead of input handlers, we could use classes for defining conversations. So we are able to write more well-architected code, even when it is complex.
Example:
Additional context
Not sure, if we can do this way.
We discussed about it in Telegram group.
The text was updated successfully, but these errors were encountered: