From 2d0a34c34b2947e8f12372d6e1c56fd5bed01673 Mon Sep 17 00:00:00 2001 From: OvyFlash Date: Tue, 4 Jul 2023 23:00:35 +0300 Subject: [PATCH] Add types_tests for bot api 6.6 and replace PNGSticker and TGSSticker with the parameters sticker --- configs.go | 34 ++++++---------------------------- types_test.go | 10 ++++++++++ 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/configs.go b/configs.go index 7973bac..5ca9e43 100644 --- a/configs.go +++ b/configs.go @@ -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. diff --git a/types_test.go b/types_test.go index 2dfe1d1..e4e3da1 100644 --- a/types_test.go +++ b/types_test.go @@ -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.