From b2a6777995c55233a47212743c781a27dde8dce6 Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 2 Nov 2017 17:09:34 +0100 Subject: Use matterbridge vendored slack --- vendor/github.com/matterbridge/slack/emoji.go | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vendor/github.com/matterbridge/slack/emoji.go (limited to 'vendor/github.com/matterbridge/slack/emoji.go') diff --git a/vendor/github.com/matterbridge/slack/emoji.go b/vendor/github.com/matterbridge/slack/emoji.go new file mode 100644 index 00000000..5da9da41 --- /dev/null +++ b/vendor/github.com/matterbridge/slack/emoji.go @@ -0,0 +1,33 @@ +package slack + +import ( + "context" + "errors" + "net/url" +) + +type emojiResponseFull struct { + Emoji map[string]string `json:"emoji"` + SlackResponse +} + +// GetEmoji retrieves all the emojis +func (api *Client) GetEmoji() (map[string]string, error) { + return api.GetEmojiContext(context.Background()) +} + +// GetEmojiContext retrieves all the emojis with a custom context +func (api *Client) GetEmojiContext(ctx context.Context) (map[string]string, error) { + values := url.Values{ + "token": {api.config.token}, + } + response := &emojiResponseFull{} + err := post(ctx, "emoji.list", values, response, api.debug) + if err != nil { + return nil, err + } + if !response.Ok { + return nil, errors.New(response.Error) + } + return response.Emoji, nil +} -- cgit v1.2.3