mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[overlays] Fix: JOIN / PART events spamming the database
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
7f4470e692
commit
fbfcb959c0
1 changed files with 9 additions and 11 deletions
|
@ -192,23 +192,21 @@ func Register(args plugins.RegistrationArguments) (err error) {
|
||||||
Fields: eventData,
|
Fields: eventData,
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.EventID, err = addChannelEvent(db, plugins.DeriveChannel(nil, eventData), socketMessage{
|
if !str.StringInSlice(event, storeExemption) {
|
||||||
IsLive: false,
|
if msg.EventID, err = addChannelEvent(db, plugins.DeriveChannel(nil, eventData), socketMessage{
|
||||||
Time: time.Now(),
|
IsLive: false,
|
||||||
Type: event,
|
Time: time.Now(),
|
||||||
Fields: eventData,
|
Type: event,
|
||||||
}); err != nil {
|
Fields: eventData,
|
||||||
return errors.Wrap(err, "storing event")
|
}); err != nil {
|
||||||
|
return errors.Wrap(err, "storing event")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fn := range subscribers {
|
for _, fn := range subscribers {
|
||||||
fn(msg)
|
fn(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if str.StringInSlice(event, storeExemption) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("registering event handler: %w", err)
|
return fmt.Errorf("registering event handler: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue