summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/bots.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-09-07 22:46:58 +0200
committerGitHub <noreply@github.com>2019-09-07 22:46:58 +0200
commita3bee01e0af3394c19360b98fd2db1b647f49299 (patch)
treeffc5778361d55d592a718354a37c9251e75fc7f6 /vendor/github.com/nlopes/slack/bots.go
parent1dc93ec4f001edd01daccbe408767d4878be25a3 (diff)
downloadmatterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.gz
matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.bz2
matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.zip
Update dependencies (#886)
Diffstat (limited to 'vendor/github.com/nlopes/slack/bots.go')
-rw-r--r--vendor/github.com/nlopes/slack/bots.go18
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
}