diff --git a/config-example/bot.yml b/config-example/bot.yml index eae5ca33..ca1b4d08 100644 --- a/config-example/bot.yml +++ b/config-example/bot.yml @@ -32,6 +32,10 @@ metrics: false # true: enables prometheus metrics on localhost port 8080 # false: disable prometheus metrics +# Optional +# If you just want to customize default text of help, and keep help generation as is +# custom_help_text_prefix: "Hello from flotbot! I understand these commands:" + # Optional # If you want to customize your help text # custom_help_text: > diff --git a/core/matcher.go b/core/matcher.go index 40cbcb40..bf445710 100644 --- a/core/matcher.go +++ b/core/matcher.go @@ -190,6 +190,10 @@ func handleNoMatch(outputMsgs chan<- models.Message, message models.Message, hit // If custom_help_text is not set, use default Help Text, for each rule use help_text from rule file if helpMsg == "" { helpMsg = "I understand these commands: \n" + if bot.CustomHelpTextPrefix != "" { + helpMsg = bot.CustomHelpTextPrefix + "\n" + } + // Go through all the rules and collect the help_text for _, rule := range rules { // Is the rule active and does the user want to expose the help for it? 'hear' rules don't show in help by default diff --git a/models/bot.go b/models/bot.go index e82d0c75..5ec17853 100644 --- a/models/bot.go +++ b/models/bot.go @@ -39,6 +39,7 @@ type Bot struct { Debug bool `mapstructure:"debug,omitempty"` Metrics bool `mapstructure:"metrics,omitempty"` CustomHelpText string `mapstructure:"custom_help_text,omitempty"` + CustomHelpTextPrefix string `mapstructure:"custom_help_text_prefix,omitempty"` DisableNoMatchHelp bool `mapstructure:"disable_no_match_help,omitempty"` RespondToBots bool `mapstructure:"respond_to_bots,omitempty"` // System