Fix: Do not send update when not asked to

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-02 17:40:38 +02:00
parent 43849052e1
commit 2eb12900b9
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -90,10 +90,7 @@ func (r *twitchWatcher) updateChannelFromAPI(channel string, sendUpdate bool) er
return nil
}
if r.ChannelStatus[channel] == nil {
r.ChannelStatus[channel] = &status
}
if sendUpdate && r.ChannelStatus[channel] != nil {
if r.ChannelStatus[channel].Category != status.Category {
log.WithFields(log.Fields{
"channel": channel,
@ -127,6 +124,7 @@ func (r *twitchWatcher) updateChannelFromAPI(channel string, sendUpdate bool) er
go handleMessage(nil, nil, evt, nil)
}
}
r.ChannelStatus[channel] = &status
return nil