all repos — telegram-bot-api @ fe3a0a8654d017254d5a973cf69badc1c4da4aa8

Golang bindings for the Telegram Bot API

Merge pull request #300 from yi-jiayu/upload-file-response-parameters

Include ResponseParameters in UploadFile error
Syfaro syfaro@huefox.com
Tue, 21 Jul 2020 03:14:03 -0500
commit

fe3a0a8654d017254d5a973cf69badc1c4da4aa8

parent

aea186240dd3e8d1829b19797a6bcabbf7af79f1

1 files changed, 8 insertions(+), 4 deletions(-)

jump to
M bot.gobot.go

@@ -245,7 +245,11 @@ return APIResponse{}, err

} if !apiResp.Ok { - return APIResponse{}, errors.New(apiResp.Description) + parameters := ResponseParameters{} + if apiResp.Parameters != nil { + parameters = *apiResp.Parameters + } + return apiResp, Error{Code: apiResp.ErrorCode, Message: apiResp.Description, ResponseParameters: parameters} } return apiResp, nil

@@ -765,9 +769,9 @@ return bot.MakeRequest("unbanChatMember", v)

} // RestrictChatMember to restrict a user in a supergroup. The bot must be an -//administrator in the supergroup for this to work and must have the -//appropriate admin rights. Pass True for all boolean parameters to lift -//restrictions from a user. Returns True on success. +// administrator in the supergroup for this to work and must have the +// appropriate admin rights. Pass True for all boolean parameters to lift +// restrictions from a user. Returns True on success. func (bot *BotAPI) RestrictChatMember(config RestrictChatMemberConfig) (APIResponse, error) { v := url.Values{}