mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
Fix: Tests fail when config is nil as of field usage
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
60fe2621c4
commit
dac0553bdf
1 changed files with 4 additions and 1 deletions
|
@ -16,7 +16,6 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]
|
||||||
|
|
||||||
if m != nil {
|
if m != nil {
|
||||||
fields["msg"] = m
|
fields["msg"] = m
|
||||||
fields["permitTimeout"] = int64(config.PermitTimeout / time.Second)
|
|
||||||
fields["username"] = m.User
|
fields["username"] = m.User
|
||||||
|
|
||||||
if m.Command == "PRIVMSG" && len(m.Params) > 0 {
|
if m.Command == "PRIVMSG" && len(m.Params) > 0 {
|
||||||
|
@ -24,6 +23,10 @@ func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config != nil {
|
||||||
|
fields["permitTimeout"] = int64(config.PermitTimeout / time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
// Parse and execute template
|
// Parse and execute template
|
||||||
tpl, err := template.
|
tpl, err := template.
|
||||||
New(tplString).
|
New(tplString).
|
||||||
|
|
Loading…
Reference in a new issue