diff options
Diffstat (limited to 'vendor/github.com/nlopes/slack/bots.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/bots.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/vendor/github.com/nlopes/slack/bots.go b/vendor/github.com/nlopes/slack/bots.go index e27e76ab..5d5a2add 100644 --- a/vendor/github.com/nlopes/slack/bots.go +++ b/vendor/github.com/nlopes/slack/bots.go @@ -2,7 +2,6 @@ package slack import ( "context" - "errors" "net/url" ) @@ -19,15 +18,17 @@ type botResponseFull struct { SlackResponse } -func botRequest(ctx context.Context, client httpClient, path string, values url.Values, d debug) (*botResponseFull, error) { +func (api *Client) botRequest(ctx context.Context, path string, values url.Values) (*botResponseFull, error) { response := &botResponseFull{} - err := postSlackMethod(ctx, client, path, values, response, d) + err := api.postMethod(ctx, path, values, response) if err != nil { return nil, err } - if !response.Ok { - return nil, errors.New(response.Error) + + if err := response.Err(); err != nil { + return nil, err } + return response, nil } @@ -40,10 +41,13 @@ func (api *Client) GetBotInfo(bot string) (*Bot, error) { func (api *Client) GetBotInfoContext(ctx context.Context, bot string) (*Bot, error) { values := url.Values{ "token": {api.token}, - "bot": {bot}, } - response, err := botRequest(ctx, api.httpclient, "bots.info", values, api) + if bot != "" { + values.Add("bot", bot) + } + + response, err := api.botRequest(ctx, "bots.info", values) if err != nil { return nil, err } |