all repos — telegram-bot-api @ e0d9306d8b80a6a5f9ac4d2aafa01bd790d6c10c

Golang bindings for the Telegram Bot API

Include ResponseParameters in UploadFile error

This makes UploadFile behave more similarly to MakeRequest when the
response is not ok.
Jiayu Yi yijiayu@gmail.com
Mon, 13 Jan 2020 22:08:58 +0800
commit

e0d9306d8b80a6a5f9ac4d2aafa01bd790d6c10c

parent

aa124ef1e84ecc14654ad242f3cf3bd2b0d5956c

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

jump to
M bot.gobot.go

@@ -226,7 +226,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

@@ -740,9 +744,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{}