Browse Source

Use Telegram Mini App for open WebApp button

master
Kenneth Bruen 11 months ago
parent
commit
365e76b4aa
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 14
      pkg/handlers/findTrain.go

14
pkg/handlers/findTrain.go

@ -26,7 +26,7 @@ const (
subscribeButton = "Subscribe to updates"
unsubscribeButton = "Unsubscribe from updates"
openInWebAppButton = "Open in WebApp"
viewInWebAppButton = "View in WebApp"
)
const (
@ -290,8 +290,16 @@ func GetTrainNumberCommandResponseButtons(trainNumber string, date time.Time, gr
}
result = append(result, []models.InlineKeyboardButton{
{
Text: openInWebAppButton,
URL: kaiUrl.String(),
Text: viewInWebAppButton,
WebApp: &models.WebAppInfo{
URL: func() string {
miniAppUrl := *kaiUrl
miniAppUrlQuery := miniAppUrl.Query()
miniAppUrlQuery.Add("tg", "1")
miniAppUrl.RawQuery = miniAppUrlQuery.Encode()
return miniAppUrl.String()
}(),
},
},
})
return models.InlineKeyboardMarkup{

Loading…
Cancel
Save