2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2016-01-09 08:54:07 -06:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
2017-03-13 09:23:16 -04:00
|
|
|
package app
|
2016-01-09 08:54:07 -06:00
|
|
|
|
|
|
|
|
import (
|
2019-04-23 09:33:42 -04:00
|
|
|
goi18n "github.com/mattermost/go-i18n/i18n"
|
2017-09-06 23:05:10 -07:00
|
|
|
"github.com/mattermost/mattermost-server/model"
|
2016-01-09 08:54:07 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ShrugProvider struct {
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 18:52:43 -08:00
|
|
|
const (
|
|
|
|
|
CMD_SHRUG = "shrug"
|
|
|
|
|
)
|
|
|
|
|
|
2016-01-09 08:54:07 -06:00
|
|
|
func init() {
|
|
|
|
|
RegisterCommandProvider(&ShrugProvider{})
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 18:52:43 -08:00
|
|
|
func (me *ShrugProvider) GetTrigger() string {
|
|
|
|
|
return CMD_SHRUG
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 14:46:20 -06:00
|
|
|
func (me *ShrugProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
|
2016-01-09 08:54:07 -06:00
|
|
|
return &model.Command{
|
2016-02-01 18:52:43 -08:00
|
|
|
Trigger: CMD_SHRUG,
|
2016-01-09 08:54:07 -06:00
|
|
|
AutoComplete: true,
|
2017-03-13 09:23:16 -04:00
|
|
|
AutoCompleteDesc: T("api.command_shrug.desc"),
|
|
|
|
|
AutoCompleteHint: T("api.command_shrug.hint"),
|
|
|
|
|
DisplayName: T("api.command_shrug.name"),
|
2016-01-09 08:54:07 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-14 12:01:44 -05:00
|
|
|
func (me *ShrugProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse {
|
2016-01-09 09:22:14 -06:00
|
|
|
rmsg := `¯\\\_(ツ)\_/¯`
|
|
|
|
|
if len(message) > 0 {
|
|
|
|
|
rmsg = message + " " + rmsg
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL, Text: rmsg}
|
2016-01-09 08:54:07 -06:00
|
|
|
}
|