Moving slash-commands out of app package (#14979)
* Moving slash-commands out of app package * Fixing golint checks * Fixing golangci-lint * Fixing golangci-lint errors
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
788c130774
Коммит
1f09d86f42
43
app/slashcommands/command_settings.go
Обычный файл
43
app/slashcommands/command_settings.go
Обычный файл
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package slashcommands
|
||||
|
||||
import (
|
||||
goi18n "github.com/mattermost/go-i18n/i18n"
|
||||
"github.com/mattermost/mattermost-server/v5/app"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
type SettingsProvider struct {
|
||||
}
|
||||
|
||||
const (
|
||||
CMD_SETTINGS = "settings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
app.RegisterCommandProvider(&SettingsProvider{})
|
||||
}
|
||||
|
||||
func (settings *SettingsProvider) GetTrigger() string {
|
||||
return CMD_SETTINGS
|
||||
}
|
||||
|
||||
func (settings *SettingsProvider) GetCommand(a *app.App, T goi18n.TranslateFunc) *model.Command {
|
||||
return &model.Command{
|
||||
Trigger: CMD_SETTINGS,
|
||||
AutoComplete: true,
|
||||
AutoCompleteDesc: T("api.command_settings.desc"),
|
||||
AutoCompleteHint: "",
|
||||
DisplayName: T("api.command_settings.name"),
|
||||
}
|
||||
}
|
||||
|
||||
func (settings *SettingsProvider) DoCommand(a *app.App, args *model.CommandArgs, message string) *model.CommandResponse {
|
||||
// This command is handled client-side and shouldn't hit the server.
|
||||
return &model.CommandResponse{
|
||||
Text: args.T("api.command_settings.unsupported.app_error"),
|
||||
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user