mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
[templating] Fix: State might not be present
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
87df2040e4
commit
f249c25317
1 changed files with 6 additions and 1 deletions
|
@ -22,7 +22,12 @@ func init() {
|
|||
|
||||
tplFuncs.Register("botHasBadge", func(m *irc.Message, r *plugins.Rule, fields map[string]interface{}) interface{} {
|
||||
return func(badge string) bool {
|
||||
return botUserstate.Get(plugins.DeriveChannel(m, nil)).Badges.Has(badge)
|
||||
state := botUserstate.Get(plugins.DeriveChannel(m, nil))
|
||||
if state == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return state.Badges.Has(badge)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue