Add AnswerShippingQuery and AnswerPreCheckoutQuery functions

master
Astra 2024-04-30 15:03:05 +01:00
parent 3cb910b3f0
commit b3ff45389c
1 changed files with 26 additions and 0 deletions

26
bot.go
View File

@ -620,6 +620,32 @@ func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHigh
return highScores, err
}
// AnswerShippingQuery allows you to reply to Update with shipping_query parameter.
func (bot *BotAPI) AnswerShippingQuery(config ShippingConfig) (ShippingQuery, error) {
resp, err := bot.Request(config)
if err != nil {
return ShippingQuery{}, err
}
var shippingQuery ShippingQuery
err = json.Unmarshal(resp.Result, &shippingQuery)
return shippingQuery, err
}
// AnswerPreCheckoutQuery allows you to reply to Update with pre_checkout_query.
func (bot *BotAPI) AnswerPreCheckoutQuery(config PreCheckoutConfig) (PreCheckoutQuery, error) {
resp, err := bot.Request(config)
if err != nil {
return PreCheckoutQuery{}, err
}
var preCheckoutQuery PreCheckoutQuery
err = json.Unmarshal(resp.Result, &preCheckoutQuery)
return preCheckoutQuery, err
}
// GetInviteLink get InviteLink for a chat
func (bot *BotAPI) GetInviteLink(config ChatInviteLinkConfig) (string, error) {
resp, err := bot.Request(config)