diff --git a/msgformatter.go b/msgformatter.go index 4264ed7..29d2efe 100644 --- a/msgformatter.go +++ b/msgformatter.go @@ -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) diff --git a/wiki/Home.md b/wiki/Home.md index f139324..6a1493c 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -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