Add types_tests for bot api 6.6 and replace PNGSticker and TGSSticker with the parameters sticker

bot-api-6.6
OvyFlash 2023-07-04 23:00:35 +03:00
parent a4b5cdb16f
commit 2d0a34c34b
2 changed files with 16 additions and 28 deletions

View File

@ -2165,15 +2165,10 @@ func (config UploadStickerConfig) params() (Params, error) {
}
func (config UploadStickerConfig) files() []RequestFile {
return []RequestFile{{
Name: "png_sticker",
Data: config.PNGSticker,
}}
return []RequestFile{config.Sticker}
}
// NewStickerSetConfig allows creating a new sticker set.
//
// You must set either PNGSticker or TGSSticker.
type NewStickerSetConfig struct {
UserID int64
Name string
@ -2204,17 +2199,11 @@ func (config NewStickerSetConfig) params() (Params, error) {
}
func (config NewStickerSetConfig) files() []RequestFile {
if config.PNGSticker != nil {
return []RequestFile{{
Name: "png_sticker",
Data: config.PNGSticker,
}}
requestFiles := []RequestFile{}
for _, v := range config.Stickers {
requestFiles = append(requestFiles, v.Sticker)
}
return []RequestFile{{
Name: "tgs_sticker",
Data: config.TGSSticker,
}}
return requestFiles
}
// AddStickerConfig allows you to add a sticker to a set.
@ -2238,18 +2227,7 @@ func (config AddStickerConfig) params() (Params, error) {
}
func (config AddStickerConfig) files() []RequestFile {
if config.PNGSticker != nil {
return []RequestFile{{
Name: "png_sticker",
Data: config.PNGSticker,
}}
}
return []RequestFile{{
Name: "tgs_sticker",
Data: config.TGSSticker,
}}
return []RequestFile{config.Sticker.Sticker}
}
// SetStickerPositionConfig allows you to change the position of a sticker in a set.

View File

@ -359,6 +359,16 @@ var (
_ Chattable = ReopenGeneralForumTopicConfig{}
_ Chattable = HideGeneralForumTopicConfig{}
_ Chattable = UnhideGeneralForumTopicConfig{}
_ Chattable = SetCustomEmojiStickerSetThumbnalConfig{}
_ Chattable = SetStickerSetTitleConfig{}
_ Chattable = DeleteStickerSetConfig{}
_ Chattable = SetStickerEmojiListConfig{}
_ Chattable = SetStickerKeywordsConfig{}
_ Chattable = SetStickerMaskPositionConfig{}
_ Chattable = GetMyDescriptionConfig{}
_ Chattable = SetMyDescriptionConfig{}
_ Chattable = GetMyShortDescriptionConfig{}
_ Chattable = SetMyShortDescriptionConfig{}
)
// Ensure all Fileable types are correct.