Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing preCheckoutQuery and callBackQuery #317

Open
huuudrich opened this issue Feb 5, 2024 · 0 comments
Open

Processing preCheckoutQuery and callBackQuery #317

huuudrich opened this issue Feb 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@huuudrich
Copy link

huuudrich commented Feb 5, 2024

In this order, the code works

fun execute(@NonNull processBot: Bot.Builder) {
        processBot.dispatch {
            callbackQuery {
                    initCallBackQuery(callbackQuery, bot)
            }
            text {
                val chatId = update.message?.chat?.id

                if (chatId == null) {
                    initAdminCommands(text, bot, update)
                    initAdminStates(bot, update)
                } else {
                    initCommands(text, bot, update)
                    initUserStates(bot, update)
                }
            }
            preCheckoutQuery {
                log.info { "Получен preCheckoutQuery: ${preCheckoutQuery.id}" }
                bot.answerPreCheckoutQuery(preCheckoutQuery.id, ok = true)

                message { paymentProcessingAction.execute(bot, message) }
            }
        }
    }

But if we rearrange them, we get an error related to threads

          preCheckoutQuery {
                log.info { "Получен preCheckoutQuery: ${preCheckoutQuery.id}" }
                bot.answerPreCheckoutQuery(preCheckoutQuery.id, ok = true)

                message { paymentProcessingAction.execute(bot, message) }
            }
            callbackQuery {
                initCallBackQuery(callbackQuery, bot)
            }

log.txt

@huuudrich huuudrich added the bug Something isn't working label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants