diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-04 11:38:27 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-04 11:38:27 -0500 |
commit | 4f1dbb8ca9a6cce09c9a20e91e074feaadd755a8 (patch) | |
tree | d5811b516ef8b826e6ccd80efdf72c6fe52157a2 /api/command_shrug.go | |
parent | 852acf1bb2818316e40012a385a5e8bec287eb05 (diff) | |
parent | dffc5323ecd9c7bc1af0ea06ef4827078f9bcd52 (diff) | |
download | chat-4f1dbb8ca9a6cce09c9a20e91e074feaadd755a8.tar.gz chat-4f1dbb8ca9a6cce09c9a20e91e074feaadd755a8.tar.bz2 chat-4f1dbb8ca9a6cce09c9a20e91e074feaadd755a8.zip |
Merge pull request #2052 from mattermost/PLT-1429
PLT-1429 adding user created slash commands
Diffstat (limited to 'api/command_shrug.go')
-rw-r--r-- | api/command_shrug.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/api/command_shrug.go b/api/command_shrug.go new file mode 100644 index 000000000..8fb5bc200 --- /dev/null +++ b/api/command_shrug.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package api + +import ( + "github.com/mattermost/platform/model" +) + +type ShrugProvider struct { +} + +const ( + CMD_SHRUG = "shrug" +) + +func init() { + RegisterCommandProvider(&ShrugProvider{}) +} + +func (me *ShrugProvider) GetTrigger() string { + return CMD_SHRUG +} + +func (me *ShrugProvider) GetCommand(c *Context) *model.Command { + return &model.Command{ + Trigger: CMD_SHRUG, + AutoComplete: true, + AutoCompleteDesc: c.T("api.command_shrug.desc"), + AutoCompleteHint: c.T("api.command_shrug.hint"), + DisplayName: c.T("api.command_shrug.name"), + } +} + +func (me *ShrugProvider) DoCommand(c *Context, channelId string, message string) *model.CommandResponse { + rmsg := `¯\\\_(ツ)\_/¯` + if len(message) > 0 { + rmsg = message + " " + rmsg + } + + return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL, Text: rmsg} +} |