https://mattermost.atlassian.net/browse/MM-36271 ```release-note We bump the major version to 6.0 ```
45 строки
1.1 KiB
Go
45 строки
1.1 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/v6/app"
|
|
"github.com/mattermost/mattermost-server/v6/app/request"
|
|
"github.com/mattermost/mattermost-server/v6/model"
|
|
"github.com/mattermost/mattermost-server/v6/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, c *request.Context, args *model.CommandArgs, message string) *model.CommandResponse {
|
|
return &model.CommandResponse{
|
|
ResponseType: model.CommandResponseTypeInChannel,
|
|
Type: model.PostTypeMe,
|
|
Text: "*" + message + "*",
|
|
}
|
|
}
|