Closed g4s8 closed 1 year ago
It's already mentioned here: https://github.com/go-telegram-bot-api/telegram-bot-api/issues/438#issuecomment-805036458.
The updated version of your snippet (with some improvements on error handling):
if resp, err := api.Request(telegram.NewDeleteMessage(int64(chatID), msgID)); nil != err || !resp.Ok {
return fmt.Errorf("failed to delete message id %d (%s): %v", msgID, string(resp.Result), err)
}
@g4s8, please close the issue if it works.
I'm using delete message API:
When I call this API, Telegram deletes this message successfully, but telegram-bot library returns error:
json: cannot unmarshal bool into Go value of type tgbotapi.Message
.Debug logs for this call:
It looks like this library is trying to decode
"result": true
response from Telegram API into message struct.It's not a very critical issue, but because of it, I need to ignore errors from
delete
.Version is:
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1