https://mattermost.atlassian.net/browse/MM-36271 ```release-note We bump the major version to 6.0 ```
42 строки
1.1 KiB
Go
42 строки
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 OfflineProvider struct {
|
|
}
|
|
|
|
const (
|
|
CmdOffline = "offline"
|
|
)
|
|
|
|
func init() {
|
|
app.RegisterCommandProvider(&OfflineProvider{})
|
|
}
|
|
|
|
func (*OfflineProvider) GetTrigger() string {
|
|
return CmdOffline
|
|
}
|
|
|
|
func (*OfflineProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command {
|
|
return &model.Command{
|
|
Trigger: CmdOffline,
|
|
AutoComplete: true,
|
|
AutoCompleteDesc: T("api.command_offline.desc"),
|
|
DisplayName: T("api.command_offline.name"),
|
|
}
|
|
}
|
|
|
|
func (*OfflineProvider) DoCommand(a *app.App, c *request.Context, args *model.CommandArgs, message string) *model.CommandResponse {
|
|
a.SetStatusOffline(args.UserId, true)
|
|
|
|
return &model.CommandResponse{ResponseType: model.CommandResponseTypeEphemeral, Text: args.T("api.command_offline.success")}
|
|
}
|