TelegramBots icon indicating copy to clipboard operation
TelegramBots copied to clipboard

Reply flow execute only 2 flows

Open DaniilPanteleev opened this issue 3 years ago • 2 comments
trafficstars

According to documentation, Reply flow doesn`t have any constraints of flow chain amount. https://github.com/rubenlagus/TelegramBots/wiki/State-Machines#complete-example

Let's try to use this ReplyFlow, version 6.0.0

ReplyFlow.builder(db)
                .action((baseAbilityBot, update) -> silent.send("step 1", getChatId(update)))
                .onlyIf(hasMessageWith("/com1"))
                .next(Reply.of((baseAbilityBot, update) -> silent.send("step 2", getChatId(update)), hasMessageWith("/com2")))
                .next(Reply.of((baseAbilityBot, update) -> silent.send("step 3", getChatId(update)), hasMessageWith("/com3")))
                .next(Reply.of((baseAbilityBot, update) -> silent.send("step 4", getChatId(update)), hasMessageWith("/com4")))
                .build();

Expected result: All steps works correctly(after entering command to bot, it`s return text(ex. step 1)

Actual result: Only 2 first steps works. Other 2 not executes

image

DaniilPanteleev avatar Apr 22 '22 18:04 DaniilPanteleev

In debug i don`t understang 1 things.

  1. Why my condition with checking existance in Update object message with text "/com3" is false

image

DaniilPanteleev avatar Apr 22 '22 18:04 DaniilPanteleev

If don't use .onlyIf() method in builder, works perfectly. I`ll dig more.

image

DaniilPanteleev avatar Apr 22 '22 18:04 DaniilPanteleev