mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
Add channel
variable for templating
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
fc97d525f4
commit
ab42decb1b
2 changed files with 5 additions and 0 deletions
|
@ -71,6 +71,10 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]
|
|||
fields["permitTimeout"] = int64(*&config.PermitTimeout / time.Second)
|
||||
fields["username"] = m.User
|
||||
|
||||
if m.Command == "PRIVMSG" && len(m.Params) > 0 {
|
||||
fields["channel"] = m.Params[0]
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
err = tpl.Execute(buf, fields)
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ rules: # See below for examples
|
|||
|
||||
There are certain variables available in the strings with templating enabled:
|
||||
|
||||
- `channel` - Channel the message was sent to, only available for regular messages not events
|
||||
- `msg` - The message object, used in functions, should not be sent to chat
|
||||
- `permitTimeout` - Value of `permit_timeout` in seconds
|
||||
- `username` - The username of the message author
|
||||
|
|
Loading…
Reference in a new issue