Log changes in Twitch meta for events

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-02 17:33:48 +02:00
parent dbca96a138
commit a414a44190
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -91,18 +91,31 @@ func (r *twitchWatcher) updateChannelFromAPI(channel string, sendUpdate bool) er
} }
if r.ChannelStatus[channel].Category != status.Category { if r.ChannelStatus[channel].Category != status.Category {
log.WithFields(log.Fields{
"channel": channel,
"category": status.Category,
}).Debug("Twitch metadata changed")
go handleMessage(nil, nil, eventTypeTwitchCategoryUpdate, map[string]interface{}{ go handleMessage(nil, nil, eventTypeTwitchCategoryUpdate, map[string]interface{}{
"category": status.Category, "category": status.Category,
}) })
} }
if r.ChannelStatus[channel].Title != status.Title { if r.ChannelStatus[channel].Title != status.Title {
log.WithFields(log.Fields{
"channel": channel,
"title": status.Title,
}).Debug("Twitch metadata changed")
go handleMessage(nil, nil, eventTypeTwitchTitleUpdate, map[string]interface{}{ go handleMessage(nil, nil, eventTypeTwitchTitleUpdate, map[string]interface{}{
"title": status.Title, "title": status.Title,
}) })
} }
if r.ChannelStatus[channel].IsLive != status.IsLive { if r.ChannelStatus[channel].IsLive != status.IsLive {
log.WithFields(log.Fields{
"channel": channel,
"isLive": status.IsLive,
}).Debug("Twitch metadata changed")
evt := eventTypeTwitchStreamOnline evt := eventTypeTwitchStreamOnline
if !status.IsLive { if !status.IsLive {
evt = eventTypeTwitchStreamOffline evt = eventTypeTwitchStreamOffline