From e9c6cc269b5c9fe82e5f38d63344a07365bccd6b Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 13 Mar 2017 09:23:16 -0400 Subject: Move command logic into app layer (#5617) --- api/command_away.go | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 api/command_away.go (limited to 'api/command_away.go') diff --git a/api/command_away.go b/api/command_away.go deleted file mode 100644 index 6a488c081..000000000 --- a/api/command_away.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package api - -import ( - "github.com/mattermost/platform/app" - "github.com/mattermost/platform/model" -) - -type AwayProvider struct { -} - -const ( - CMD_AWAY = "away" -) - -func init() { - RegisterCommandProvider(&AwayProvider{}) -} - -func (me *AwayProvider) GetTrigger() string { - return CMD_AWAY -} - -func (me *AwayProvider) GetCommand(c *Context) *model.Command { - return &model.Command{ - Trigger: CMD_AWAY, - AutoComplete: true, - AutoCompleteDesc: c.T("api.command_away.desc"), - DisplayName: c.T("api.command_away.name"), - } -} - -func (me *AwayProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse { - rmsg := c.T("api.command_away.success") - if len(message) > 0 { - rmsg = message + " " + rmsg - } - app.SetStatusAwayIfNeeded(c.Session.UserId, true) - - return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg} -} -- cgit v1.2.3-1-g7c22