mediaInterface := []interface{}{tgbotapi.NewInputMediaPhoto(tgbotapi.FileURL(AdObj.ThumbnailImage))}
limitPhoto := 0
for _, url := range AdObj.Images {
if limitPhoto >= 9 {
break
}
limitPhoto++
mediaInterface = append([]interface{}{tgbotapi.NewInputMediaPhoto(tgbotapi.FileURL(url))}, mediaInterface...)
}
cfg := tgbotapi.NewMediaGroup(tgChatId, mediaInterface)
messages, err := bot.SendMediaGroup(cfg)
if err != nil {
log.Fatal(err)
}
if messages == nil {
log.Println("No received messages")
}
if len(messages) != len(cfg.Media) {
log.Println("Different number of messages: %d", len(messages))
}
And I got error:
./main.go:1519:86: undefined: tgbotapi.FileURL
./main.go:1526:96: undefined: tgbotapi.FileURL
./main.go:1531:38: bot.SendMediaGroup undefined (type *tgbotapi.BotAPI has no field or method SendMediaGroup)
./main.go:1540:45: cfg.Media undefined (type tgbotapi.MediaGroupConfig has no field or method Media)
I had ran go get -u github.com/go-telegram-bot-api/telegram-bot-api/v5 already.
Hi, I'm trying with https://github.com/go-telegram-bot-api/telegram-bot-api/blob/master/bot_test.go, func TestSendWithMediaGroupPhotoVideo This is my code
And I got error: ./main.go:1519:86: undefined: tgbotapi.FileURL ./main.go:1526:96: undefined: tgbotapi.FileURL ./main.go:1531:38: bot.SendMediaGroup undefined (type *tgbotapi.BotAPI has no field or method SendMediaGroup) ./main.go:1540:45: cfg.Media undefined (type tgbotapi.MediaGroupConfig has no field or method Media)
I had ran
go get -u github.com/go-telegram-bot-api/telegram-bot-api/v5
already.Can you please help me solve this problem?