diff options
author | Wim <wim@42.be> | 2020-03-01 20:59:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-01 20:59:19 +0100 |
commit | 250b3bb5795240d5ebdab5416ab99dbc41be734b (patch) | |
tree | 11e44ec2e7e37cd7eb0deaf0a7843fe6bf3c0e40 /vendor/github.com/nlopes/slack/slash.go | |
parent | e9edbfc051afc643d91fc04bc7fb3fe70039c213 (diff) | |
download | matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.gz matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.bz2 matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.zip |
Use upstream slack-go/slack again (#1018)
Diffstat (limited to 'vendor/github.com/nlopes/slack/slash.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/slash.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/vendor/github.com/nlopes/slack/slash.go b/vendor/github.com/nlopes/slack/slash.go deleted file mode 100644 index f62065a2..00000000 --- a/vendor/github.com/nlopes/slack/slash.go +++ /dev/null @@ -1,53 +0,0 @@ -package slack - -import ( - "net/http" -) - -// SlashCommand contains information about a request of the slash command -type SlashCommand struct { - Token string `json:"token"` - TeamID string `json:"team_id"` - TeamDomain string `json:"team_domain"` - EnterpriseID string `json:"enterprise_id,omitempty"` - EnterpriseName string `json:"enterprise_name,omitempty"` - ChannelID string `json:"channel_id"` - ChannelName string `json:"channel_name"` - UserID string `json:"user_id"` - UserName string `json:"user_name"` - Command string `json:"command"` - Text string `json:"text"` - ResponseURL string `json:"response_url"` - TriggerID string `json:"trigger_id"` -} - -// SlashCommandParse will parse the request of the slash command -func SlashCommandParse(r *http.Request) (s SlashCommand, err error) { - if err = r.ParseForm(); err != nil { - return s, err - } - s.Token = r.PostForm.Get("token") - s.TeamID = r.PostForm.Get("team_id") - s.TeamDomain = r.PostForm.Get("team_domain") - s.EnterpriseID = r.PostForm.Get("enterprise_id") - s.EnterpriseName = r.PostForm.Get("enterprise_name") - s.ChannelID = r.PostForm.Get("channel_id") - s.ChannelName = r.PostForm.Get("channel_name") - s.UserID = r.PostForm.Get("user_id") - s.UserName = r.PostForm.Get("user_name") - s.Command = r.PostForm.Get("command") - s.Text = r.PostForm.Get("text") - s.ResponseURL = r.PostForm.Get("response_url") - s.TriggerID = r.PostForm.Get("trigger_id") - return s, nil -} - -// ValidateToken validates verificationTokens -func (s SlashCommand) ValidateToken(verificationTokens ...string) bool { - for _, token := range verificationTokens { - if s.Token == token { - return true - } - } - return false -} |