-
Hi! any ideas where to find example how to create several menus and use each on in the particular scene (for instance to get user choice and select the next scene to move to accordingly)? For me unfortunately its not obvious from this example. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 read the state of the scenes you can also read that from the function in bot.filter. Personally I would prefer going with the I hope it helps! |
Beta Was this translation helpful? Give feedback.
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:
As you can also r…