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

View File

@ -359,6 +359,16 @@ var (
_ Chattable = ReopenGeneralForumTopicConfig{} _ Chattable = ReopenGeneralForumTopicConfig{}
_ Chattable = HideGeneralForumTopicConfig{} _ Chattable = HideGeneralForumTopicConfig{}
_ Chattable = UnhideGeneralForumTopicConfig{} _ 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. // Ensure all Fileable types are correct.