mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
Fix: Do not extract fields from nil message
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
5d44822a27
commit
6a03840592
1 changed files with 7 additions and 5 deletions
|
@ -14,6 +14,7 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]
|
||||||
fields = map[string]interface{}{}
|
fields = map[string]interface{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m != nil {
|
||||||
fields["msg"] = m
|
fields["msg"] = m
|
||||||
fields["permitTimeout"] = int64(config.PermitTimeout / time.Second)
|
fields["permitTimeout"] = int64(config.PermitTimeout / time.Second)
|
||||||
fields["username"] = m.User
|
fields["username"] = m.User
|
||||||
|
@ -21,6 +22,7 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]
|
||||||
if m.Command == "PRIVMSG" && len(m.Params) > 0 {
|
if m.Command == "PRIVMSG" && len(m.Params) > 0 {
|
||||||
fields["channel"] = m.Params[0]
|
fields["channel"] = m.Params[0]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Parse and execute template
|
// Parse and execute template
|
||||||
tpl, err := template.
|
tpl, err := template.
|
||||||
|
|
Loading…
Reference in a new issue