Merge branch 'master' into bot-api-6.3
This commit is contained in:
commit
2e912ef461
3 changed files with 158 additions and 9 deletions
84
configs.go
84
configs.go
|
@ -1166,6 +1166,7 @@ type WebhookConfig struct {
|
|||
MaxConnections int
|
||||
AllowedUpdates []string
|
||||
DropPendingUpdates bool
|
||||
SecretToken string
|
||||
}
|
||||
|
||||
func (config WebhookConfig) method() string {
|
||||
|
@ -1183,6 +1184,7 @@ func (config WebhookConfig) params() (Params, error) {
|
|||
params.AddNonZero("max_connections", config.MaxConnections)
|
||||
err := params.AddInterface("allowed_updates", config.AllowedUpdates)
|
||||
params.AddBool("drop_pending_updates", config.DropPendingUpdates)
|
||||
params.AddNonEmpty("secret_token", config.SecretToken)
|
||||
|
||||
return params, err
|
||||
}
|
||||
|
@ -1788,6 +1790,64 @@ func (config InvoiceConfig) method() string {
|
|||
return "sendInvoice"
|
||||
}
|
||||
|
||||
// InvoiceLinkConfig contains information for createInvoiceLink method
|
||||
type InvoiceLinkConfig struct {
|
||||
Title string //Required
|
||||
Description string //Required
|
||||
Payload string //Required
|
||||
ProviderToken string //Required
|
||||
Currency string //Required
|
||||
Prices []LabeledPrice //Required
|
||||
MaxTipAmount int
|
||||
SuggestedTipAmounts []int
|
||||
ProviderData string
|
||||
PhotoURL string
|
||||
PhotoSize int
|
||||
PhotoWidth int
|
||||
PhotoHeight int
|
||||
NeedName bool
|
||||
NeedPhoneNumber bool
|
||||
NeedEmail bool
|
||||
NeedShippingAddress bool
|
||||
SendPhoneNumberToProvider bool
|
||||
SendEmailToProvider bool
|
||||
IsFlexible bool
|
||||
}
|
||||
|
||||
func (config InvoiceLinkConfig) params() (Params, error) {
|
||||
params := make(Params)
|
||||
|
||||
params["title"] = config.Title
|
||||
params["description"] = config.Description
|
||||
params["payload"] = config.Payload
|
||||
params["provider_token"] = config.ProviderToken
|
||||
params["currency"] = config.Currency
|
||||
if err := params.AddInterface("prices", config.Prices); err != nil {
|
||||
return params, err
|
||||
}
|
||||
|
||||
params.AddNonZero("max_tip_amount", config.MaxTipAmount)
|
||||
err := params.AddInterface("suggested_tip_amounts", config.SuggestedTipAmounts)
|
||||
params.AddNonEmpty("provider_data", config.ProviderData)
|
||||
params.AddNonEmpty("photo_url", config.PhotoURL)
|
||||
params.AddNonZero("photo_size", config.PhotoSize)
|
||||
params.AddNonZero("photo_width", config.PhotoWidth)
|
||||
params.AddNonZero("photo_height", config.PhotoHeight)
|
||||
params.AddBool("need_name", config.NeedName)
|
||||
params.AddBool("need_phone_number", config.NeedPhoneNumber)
|
||||
params.AddBool("need_email", config.NeedEmail)
|
||||
params.AddBool("need_shipping_address", config.NeedShippingAddress)
|
||||
params.AddBool("send_phone_number_to_provider", config.SendPhoneNumberToProvider)
|
||||
params.AddBool("send_email_to_provider", config.SendEmailToProvider)
|
||||
params.AddBool("is_flexible", config.IsFlexible)
|
||||
|
||||
return params, err
|
||||
}
|
||||
|
||||
func (config InvoiceLinkConfig) method() string {
|
||||
return "createInvoiceLink"
|
||||
}
|
||||
|
||||
// ShippingConfig contains information for answerShippingQuery request.
|
||||
type ShippingConfig struct {
|
||||
ShippingQueryID string // required
|
||||
|
@ -2008,6 +2068,24 @@ func (config GetStickerSetConfig) params() (Params, error) {
|
|||
return params, nil
|
||||
}
|
||||
|
||||
// GetCustomEmojiStickersConfig get information about
|
||||
// custom emoji stickers by their identifiers.
|
||||
type GetCustomEmojiStickersConfig struct {
|
||||
CustomEmojiIDs []string
|
||||
}
|
||||
|
||||
func (config GetCustomEmojiStickersConfig) params() (Params, error) {
|
||||
params := make(Params)
|
||||
|
||||
params.AddInterface("custom_emoji_ids", config.CustomEmojiIDs)
|
||||
|
||||
return params, nil
|
||||
}
|
||||
|
||||
func (config GetCustomEmojiStickersConfig) method() string {
|
||||
return "getCustomEmojiStickers"
|
||||
}
|
||||
|
||||
// UploadStickerConfig allows you to upload a sticker for use in a set later.
|
||||
type UploadStickerConfig struct {
|
||||
UserID int64
|
||||
|
@ -2042,8 +2120,9 @@ type NewStickerSetConfig struct {
|
|||
Title string
|
||||
PNGSticker RequestFileData
|
||||
TGSSticker RequestFileData
|
||||
StickerType string
|
||||
Emojis string
|
||||
ContainsMasks bool
|
||||
ContainsMasks bool // deprecated
|
||||
MaskPosition *MaskPosition
|
||||
}
|
||||
|
||||
|
@ -2057,11 +2136,10 @@ func (config NewStickerSetConfig) params() (Params, error) {
|
|||
params.AddNonZero64("user_id", config.UserID)
|
||||
params["name"] = config.Name
|
||||
params["title"] = config.Title
|
||||
|
||||
params["emojis"] = config.Emojis
|
||||
|
||||
params.AddBool("contains_masks", config.ContainsMasks)
|
||||
|
||||
params.AddNonEmpty("sticker_type", string(config.StickerType))
|
||||
err := params.AddInterface("mask_position", config.MaskPosition)
|
||||
|
||||
return params, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue