telebot icon indicating copy to clipboard operation
telebot copied to clipboard

proposal: bot: identify the button by its callback

Open bazuker opened this issue 6 years ago • 1 comments

When you are putting a handler for an inline button, all you get in the callback is a reference to a callback object

func handler(c *tb.Callback) {
	...
}

but there is no way to identify which inline button this callback was made from. This prevents a developer from creating a handler middleware for inline buttons aggregation as there is no easy way to find the button that was pressed, as you just assume that every button has its own handler.

Something that would be great to have is

func handler(button *tb.InlineButton, c *tb.Callback) {
	...
}

or for the callback to have any button-related information. Even the unique id that is used in creation of an inline button would be very handy.

A good package anyways, Thanks

bazuker avatar Jan 22 '19 22:01 bazuker

It's real with the context-based routing I described here. Marked it as a feature, seems quite helpful.

demget avatar Mar 29 '20 20:03 demget