Getting into a loop
See original GitHub issueExpected behavior
there is a message
block inside the callbackQuery(A)
. inside that message
block we ask yes or no question with InlineKeyboardButton
. for example, if the user chooses yes, it will go to callbackQuery(B)
. but if chooses no, callbackQuery(A)
will be called again.
Actual behavior
The problem starts when the user chooses no for the first time. after going throw all again, if he chooses no again, InlineKeyboardButton
will popup twice!
To Reproduce
callbackQuery("A") {
val chatId = callbackQuery.message?.chat?.id ?: return@callbackQuery
bot.sendMessage(
chatId = chatId,
text = """some input""",
)
message {
val inlineKeyboardMarkup = InlineKeyboardMarkup.create(
listOf(
InlineKeyboardButton.CallbackData(text = "no", callbackData = "A"),
InlineKeyboardButton.CallbackData(text = "yes", callbackData = "B"),
),
)
bot.sendMessage(
chatId = message.chat.id,
text = """
your choice
""".trimIndent(),
replyMarkup = inlineKeyboardMarkup
)
}
}
Additional context I think the possibility of my code being wrong is high but there is no place to ask my question, so I asked here so maybe, maybe, there is a bug.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Are You Stuck In A Loop? - Medium
In Iran, when a couple is about to get married, the man essentially signs a document which mentions the amount of the dowry...
Read more >The Cognitive Emotive Loop: What it is, Why it Keeps you ...
A cognitive/emotive loop is a repeating pattern where thoughts and beliefs produce feelings that fuel our rightness about our stories, that then ...
Read more >If you got stuck in a loop, what should you do? - Quora
Control + C will break the execution of the loop and get you to the prompt. Alternatively you can use the Break key...
Read more >to get stuck in a loop - WordReference Forums
It means "to get in a situation in which there is no way-out and in which the same things keep repeating themselves over...
Read more >Human Existential Looping Problem (H.E.L.P.!)…
People who suffer with obsessive-compulsive disorder struggle with a loop of thoughts that drives repetitious behaviors.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So… I guess you can implement that in several different ways. Would the next snippet do what you want to achieve (I guess you can just filter out things in the
message
handler when you are not interested on them):@sinadarvi sorry for the delays in the response 🙏🏻, but I didn’t have time to check it.
I’ll try to take a look to it tomorrow and see what’s going on.