go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.76k stars 889 forks source link

method "Send" incorrectly return message object #590

Closed Darksidis closed 2 years ago

Darksidis commented 2 years ago

I need to get the id from the sent post, I send NewMediaGroup.

When trying to do something like this

msg := tgbotapi.NewMediaGroup(idChannel, inputFiles)
postChannel, err := bot.Send(msg)

An error pops up:

json: cannot unmarshal array into Go value of type tgbotapi.Message

How can this be resolved?

Darksidis commented 2 years ago

I figured out, there is a SendMediaGroup that returns a []Message

The return value of the Send

(Message, error)

The return value of the SendMediaGroup ([]Message, error)

I would make this point more explicit in the documentation