Skip to content

Telegraf.js Scenes. Help please. #1907

Answered by MKRhere
Alheimurin asked this question in Q&A
Discussion options

You must be logged in to vote

If you don't need step 3, the solution is simple. Move your top-level actions under stage like so:

const stage = new Stage([ buy, sell ]);
stage.action("buy", ctx => ctx.scene.enter("buyScene"));
stage.action("sell", ctx => ctx.scene.enter("sellScene"));

These will work identically to bot.action, with the exception that they intercept events before they enter scenes, and are still able to use ctx.scene. The downside is that buttons in buyScene will not work while user is in sellScene. At that point, you must wonder if the inline keyboard needs to be inside scenes at all.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Alheimurin
Comment options

@MKRhere
Comment options

@MKRhere
Comment options

Answer selected by Alheimurin
@Alheimurin
Comment options

@MKRhere
Comment options

@Alheimurin
Comment options

@MKRhere
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants