mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
Add toLower / toUpper functions
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
092143d5c7
commit
206b682f39
2 changed files with 7 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -83,6 +83,8 @@ Additionally there are some functions available in the templates:
|
|||
- `group <idx>` - Gets matching group specified by index from `match_message` regular expression
|
||||
- `recentGame <username> [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 <tagname>` - Takes the message sent to the channel, returns the value of the tag specified
|
||||
- `toLower <string>` - Converts the given string to lower-case
|
||||
- `toUpper <string>` - Converts the given string to upper-case
|
||||
|
||||
## Command executions
|
||||
|
||||
|
|
Loading…
Reference in a new issue