2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2016-05-19 07:35:12 -04:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
2017-03-13 09:23:16 -04:00
|
|
|
package app
|
2016-05-19 07:35:12 -04: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-05-19 07:35:12 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ShortcutsProvider struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
CMD_SHORTCUTS = "shortcuts"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
RegisterCommandProvider(&ShortcutsProvider{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (me *ShortcutsProvider) GetTrigger() string {
|
|
|
|
|
return CMD_SHORTCUTS
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 14:46:20 -06:00
|
|
|
func (me *ShortcutsProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
|
2016-05-19 07:35:12 -04:00
|
|
|
return &model.Command{
|
|
|
|
|
Trigger: CMD_SHORTCUTS,
|
|
|
|
|
AutoComplete: true,
|
2017-03-13 09:23:16 -04:00
|
|
|
AutoCompleteDesc: T("api.command_shortcuts.desc"),
|
2016-05-19 07:35:12 -04:00
|
|
|
AutoCompleteHint: "",
|
2017-03-13 09:23:16 -04:00
|
|
|
DisplayName: T("api.command_shortcuts.name"),
|
2016-05-19 07:35:12 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-14 12:01:44 -05:00
|
|
|
func (me *ShortcutsProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse {
|
2017-08-18 17:04:05 +08:00
|
|
|
// This command is handled client-side and shouldn't hit the server.
|
|
|
|
|
return &model.CommandResponse{
|
|
|
|
|
Text: args.T("api.command_shortcuts.unsupported.app_error"),
|
|
|
|
|
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
|
2016-07-14 15:57:06 -04:00
|
|
|
}
|
2016-05-19 07:35:12 -04:00
|
|
|
}
|