github.com/coincircle/mattermost-server@v4.8.1-0.20180321182714-9d701c704416+incompatible/app/command_help.go (about)

     1  // Copyright (c) 2017-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 HelpProvider struct {
    12  }
    13  
    14  const (
    15  	CMD_HELP = "help"
    16  )
    17  
    18  func init() {
    19  	RegisterCommandProvider(&HelpProvider{})
    20  }
    21  
    22  func (h *HelpProvider) GetTrigger() string {
    23  	return CMD_HELP
    24  }
    25  
    26  func (h *HelpProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
    27  	return &model.Command{
    28  		Trigger:          CMD_HELP,
    29  		AutoComplete:     true,
    30  		AutoCompleteDesc: T("api.command_help.desc"),
    31  		DisplayName:      T("api.command_help.name"),
    32  	}
    33  }
    34  
    35  func (h *HelpProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse {
    36  	helpLink := *a.Config().SupportSettings.HelpLink
    37  
    38  	if helpLink == "" {
    39  		helpLink = model.SUPPORT_SETTINGS_DEFAULT_HELP_LINK
    40  	}
    41  
    42  	return &model.CommandResponse{GotoLocation: helpLink}
    43  }