Proposal/WIP: InlineMenuHandler #1702
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on my personal bot, I found building menus with
InlineKeyboardMarkups
to be somewhat tiresome sometimes. You have to build a lot ofInlineKeyboardButtons
, add a lot ofCallbackQueryHandlers
to yourConversationHandler
and keep the overview in the process.This is an attempt to build a more user friendly handler as "wrapper" on top of the
ConversationHandler
for creating menus. For each state only the following information is needed:(button_label, next_state)
-type tuplesAll the labels/text may also be replaced by a callback to adjust the texts according to the user input, but that is optional.
A
InlineMenuHandler
could look like this:Especially for menus that need little processing of the user input, I hope that this is easier to maintain than a full grown
ConversationHandler
.I'm aware that such a new feature will needs thorough discussion, may well be rejected and also that we have other issues to discuss in dev chat :D Still, I wanted to put it out here.