github.com/spreadshirt/mattermost-server@v5.3.2-0.20180927191755-a257d501df3d+incompatible/app/command_online.go (about) 1 // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package app 5 6 import ( 7 "github.com/mattermost/mattermost-server/model" 8 goi18n "github.com/nicksnyder/go-i18n/i18n" 9 ) 10 11 type OnlineProvider struct { 12 } 13 14 const ( 15 CMD_ONLINE = "online" 16 ) 17 18 func init() { 19 RegisterCommandProvider(&OnlineProvider{}) 20 } 21 22 func (me *OnlineProvider) GetTrigger() string { 23 return CMD_ONLINE 24 } 25 26 func (me *OnlineProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command { 27 return &model.Command{ 28 Trigger: CMD_ONLINE, 29 AutoComplete: true, 30 AutoCompleteDesc: T("api.command_online.desc"), 31 DisplayName: T("api.command_online.name"), 32 } 33 } 34 35 func (me *OnlineProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse { 36 a.SetStatusOnline(args.UserId, true) 37 38 return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command_online.success")} 39 }