mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[templating] Fix: Use fields to get channel to support events
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f249c25317
commit
2b1502e64f
1 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/Luzifer/twitch-bot/plugins"
|
||||
"github.com/go-irc/irc"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -22,7 +23,13 @@ func init() {
|
|||
|
||||
tplFuncs.Register("botHasBadge", func(m *irc.Message, r *plugins.Rule, fields map[string]interface{}) interface{} {
|
||||
return func(badge string) bool {
|
||||
state := botUserstate.Get(plugins.DeriveChannel(m, nil))
|
||||
channel, ok := fields["channel"].(string)
|
||||
if !ok {
|
||||
log.Trace("Fields for botHasBadge function had no channel")
|
||||
return false
|
||||
}
|
||||
|
||||
state := botUserstate.Get(channel)
|
||||
if state == nil {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue