package main import ( "errors" "html" "log" telegram "github.com/go-telegram-bot-api/telegram-bot-api" ) func (this *NTFServer) uploadStickerWorker(userID int64, s *telegram.Sticker) { var conUrl string var err error if int64(s.FileSize) < this.contentedMaxBytes { conUrl, err = this.ContentedUploadSync(s.FileID, int64(s.FileSize)) } else if s.Thumbnail != nil && int64(s.Thumbnail.FileSize) < this.contentedMaxBytes { conUrl, err = this.ContentedUploadSync(s.Thumbnail.FileID, int64(s.Thumbnail.FileSize)) } else { err = errors.New("File too big and/or bad thumbnail") } // if err != nil { log.Printf("Sticker upload failed: %s", err.Error()) this.callOnMainThread <- func() { this.GroupChatSayHTML("Can't upload sticker for native users: " + html.EscapeString(err.Error()) + "") } return } // Sticker upload success this.callOnMainThread <- func() { // n.b. this will fail if the user has disconnected by the time the upload completed this.HubSay(userID, s.Emoji+" "+conUrl) } }