* extracting i18n functionality to i18n core library * Removing utils.T * Adding documentation and changing one function name for better explanation * Changing other missing utils.T * Adding license string * Renaming corelibs to pkg * Renaming corelibs to pkg (moving directory) * Renaming from pkg to shared * Fixing bodyPage.Html casing * Fixing merges * Fixing merge problem * Fixing tests
44 строки
1.0 KiB
Go
44 строки
1.0 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package slashcommands
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost-server/v5/app"
|
|
"github.com/mattermost/mattermost-server/v5/model"
|
|
"github.com/mattermost/mattermost-server/v5/shared/i18n"
|
|
)
|
|
|
|
type MeProvider struct {
|
|
}
|
|
|
|
const (
|
|
CmdMe = "me"
|
|
)
|
|
|
|
func init() {
|
|
app.RegisterCommandProvider(&MeProvider{})
|
|
}
|
|
|
|
func (*MeProvider) GetTrigger() string {
|
|
return CmdMe
|
|
}
|
|
|
|
func (*MeProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command {
|
|
return &model.Command{
|
|
Trigger: CmdMe,
|
|
AutoComplete: true,
|
|
AutoCompleteDesc: T("api.command_me.desc"),
|
|
AutoCompleteHint: T("api.command_me.hint"),
|
|
DisplayName: T("api.command_me.name"),
|
|
}
|
|
}
|
|
|
|
func (*MeProvider) DoCommand(a *app.App, args *model.CommandArgs, message string) *model.CommandResponse {
|
|
return &model.CommandResponse{
|
|
ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL,
|
|
Type: model.POST_ME,
|
|
Text: "*" + message + "*",
|
|
}
|
|
}
|