mirror of
https://github.com/dancojocaru2000/CfrTrainInfoTelegramBot.git
synced 2025-02-22 17:19:39 +02:00
Use Telegram Mini App for open WebApp button
This commit is contained in:
parent
c985a6575a
commit
365e76b4aa
1 changed files with 11 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue