Why does this code not display the pop-up window?
yaooort opened this issue · 1 comments
yaooort commented
Why does this code not display the pop-up window?
- Server returns
{"ok":false,"error_code":400,"description":"Bad Request: query is too old and response timeout expired or query ID is invalid"}
- my code
func Alert(bot *tele.Bot) {
bot.Handle("/start", func(c tele.Context) error {
c.Reply("welcome", RepButtons(bot))
return nil
})
}
// RepButtons
func RepButtons(bot *tele.Bot) *tele.ReplyMarkup {
menuMain := &tele.ReplyMarkup{ResizeKeyboard: true}
var btns []tele.Btn
var btnDelete = &tele.InlineButton{Unique: "unique123", Text: "Delete"}
query := menuMain.Data("queryBtn", "unique123", "welcome")
bot.Handle(btnDelete, func(c tele.Context) error {
return c.Respond(&tele.CallbackResponse{Text: "HAHA", ShowAlert: true})
})
btns = append(btns, query)
menuMain.Inline(btns)
return menuMain
}
Why does nothing happen when I click the button?
yaooort commented
correct code
func Alert(bot *tele.Bot) {
bot.Handle("/start", func(c tele.Context) error {
c.Reply("welcome", RepButtons(bot))
return nil
})
}
// RepButtons
func RepButtons(bot *tele.Bot) *tele.ReplyMarkup {
menuMain := &tele.ReplyMarkup{ResizeKeyboard: true}
var btns []tele.Btn
query := menuMain.Data("queryBtn", "unique123", "welcome")
bot.Handle(&query, func(c tele.Context) error {
return c.Respond(&tele.CallbackResponse{Text: "HAHA", ShowAlert: true})
})
btns = append(btns, query)
menuMain.Inline(btns)
return menuMain
}