-
Notifications
You must be signed in to change notification settings - Fork 17
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
Using ctx.reply in conversation.external terminates bot #68
Comments
Is this a duplicate of #57? It seems to me like it is |
Yes, the symptoms are not exactly the same, but it seems to be related. I have issue #57 as well with an api that I am manually binding to the context via middleware. It is available in |
Here is something I observed fot the ctx issue: The first time the conversation is played, my api object in the context is:
And in the next update, when I log it at the same line it looks like it got serialized:
|
I think this can be fixed by installing your API inside a This means you should have something like await conversation.run(async (ctx, next) => {
ctx.myapi = ... // set your custom context property here
await next()
}) in your conversation, rather than doing this in your middleware upfront. |
I am fetching some data in a conversation and would need to call ctx.reply inside of the conversation.external function. If doing so afterwards any new update will terminate the bot.
If doing it outside of conversation.external it does work, but in my use case this is not really an option as I want to update the message several times while the API is fetching.
I have created a minimal example project which can be found here: https://github.com/receter/grammy-conversations-reply-external
The text was updated successfully, but these errors were encountered: