telebot
telebot copied to clipboard
Is it possible to handle ReplyButtons with the same text?
How can I make ReplyMarkups with buttons that have the same text but different handlers?
How can I make ReplyMarkups with buttons that have the same text but different handlers?
It's just a matter of setting unique ID to a button You can do it llike so:
rpayload := fmt.Sprintf("%x",sha256.Sum256(some_random_bytes))
rpayload2 := fmt.Sprintf("%x",sha256.Sum256(some_random_bytes2))
var btnConfirm = menu.Data("CONFIRM","confirm_"+rpayload[0:9],"resp")
var btnConfirm2 = menu.Data("CONFIRM","confirm_"+rpayload2[0:9],"resp")
menu.Inline(menu.Row(btnConfirm,btnConfirm2),)
One downside of that is when you making new buttons more and more, you'll end up with a pile of garbage in handlers, because telebot has no particular way to unregister them. You'll have to hack its code a bit to make it work better then.