diff --git a/msgformatter.go b/msgformatter.go index 4fb37de..5e179c3 100644 --- a/msgformatter.go +++ b/msgformatter.go @@ -16,6 +16,11 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string] // Create anonymous functions in current context in order to access function variables messageFunctions := korvike.GetFunctionMap() + // Generic functions + messageFunctions["toLower"] = strings.ToLower + messageFunctions["toUpper"] = strings.ToUpper + + // Message specific functions messageFunctions["arg"] = func(arg int) (string, error) { msgParts := strings.Split(m.Trailing(), " ") if len(msgParts) <= arg { diff --git a/wiki/Home.md b/wiki/Home.md index 18eb1d7..038b695 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -83,6 +83,8 @@ Additionally there are some functions available in the templates: - `group ` - Gets matching group specified by index from `match_message` regular expression - `recentGame [fallback]` - Returns the last played game name of the specified user (see shoutout example) or the `fallback` if the game could not be fetched. If no fallback was supplied the message will fail and not be sent. - `tag ` - Takes the message sent to the channel, returns the value of the tag specified +- `toLower ` - Converts the given string to lower-case +- `toUpper ` - Converts the given string to upper-case ## Command executions