Skip to content

How to embed inline menu usage into the scene? #178

Answered by EdJoPaTo
lofti198 asked this question in Q&A
Discussion options

You must be logged in to vote

The idea behind the menu is to have a static, stateless structure at runtime which results in benefits for performance and easy restarts. The Scenes are the opposite here are require state and therefore I do not have avoided using them.

you can however use the menuMiddleware like any other middleware and embed it inside of filters for example. The fill guide is relevant but I suggest checking out especially the linked part: https://grammy.dev/guide/filter-queries.html#combining-queries-with-other-methods=

This way you can create stuff like this:

bot.filter(ctx => ctx.chat.type === 'private', menuMiddleware1);
bot.filter(ctx => ctx.chat.type === 'group', menuMiddleware2);

As you can also r…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lofti198
Comment options

Answer selected by lofti198
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