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" subscribeButton = "Subscribe to updates"
unsubscribeButton = "Unsubscribe from updates" unsubscribeButton = "Unsubscribe from updates"
openInWebAppButton = "Open in WebApp" viewInWebAppButton = "View in WebApp"
) )
const ( const (
@ -290,8 +290,16 @@ func GetTrainNumberCommandResponseButtons(trainNumber string, date time.Time, gr
} }
result = append(result, []models.InlineKeyboardButton{ result = append(result, []models.InlineKeyboardButton{
{ {
Text: openInWebAppButton, Text: viewInWebAppButton,
URL: kaiUrl.String(), 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{ return models.InlineKeyboardMarkup{

Loading…
Cancel
Save