mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[core] Add submysterygift event, add more event data to events
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
2261aee955
commit
d1386903da
2 changed files with 32 additions and 23 deletions
|
@ -11,6 +11,7 @@ var (
|
|||
eventTypeResub = ptrStr("resub")
|
||||
eventTypeSub = ptrStr("sub")
|
||||
eventTypeSubgift = ptrStr("subgift")
|
||||
eventTypeSubmysterygift = ptrStr("submysterygift")
|
||||
eventTypeWhisper = ptrStr("whisper")
|
||||
|
||||
eventTypeTwitchCategoryUpdate = ptrStr("category_update")
|
||||
|
@ -27,6 +28,7 @@ var (
|
|||
eventTypeResub,
|
||||
eventTypeSub,
|
||||
eventTypeSubgift,
|
||||
eventTypeSubmysterygift,
|
||||
eventTypeWhisper,
|
||||
|
||||
eventTypeTwitchCategoryUpdate,
|
||||
|
|
35
irc.go
35
irc.go
|
@ -267,51 +267,58 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
|
|||
log.WithField("msg", m).Warn("Received usernotice without msg-id")
|
||||
|
||||
case "raid":
|
||||
log.WithFields(log.Fields{
|
||||
evtData := plugins.FieldCollection{
|
||||
"channel": i.getChannel(m),
|
||||
"from": m.Tags["login"],
|
||||
"viewercount": m.Tags["msg-param-viewerCount"],
|
||||
}).Info("Incoming raid")
|
||||
}
|
||||
log.WithFields(log.Fields(evtData)).Info("Incoming raid")
|
||||
|
||||
go handleMessage(i.c, m, eventTypeRaid, nil)
|
||||
go handleMessage(i.c, m, eventTypeRaid, evtData)
|
||||
|
||||
case "resub":
|
||||
log.WithFields(log.Fields{
|
||||
evtData := plugins.FieldCollection{
|
||||
"channel": i.getChannel(m),
|
||||
"from": m.Tags["login"],
|
||||
"subscribed_months": m.Tags["msg-param-cumulative-months"],
|
||||
"plan": m.Tags["msg-param-sub-plan"],
|
||||
}).Info("User re-subscribed")
|
||||
}
|
||||
log.WithFields(log.Fields(evtData)).Info("User re-subscribed")
|
||||
|
||||
go handleMessage(i.c, m, eventTypeResub, nil)
|
||||
go handleMessage(i.c, m, eventTypeResub, evtData)
|
||||
|
||||
case "sub":
|
||||
log.WithFields(log.Fields{
|
||||
evtData := plugins.FieldCollection{
|
||||
"channel": i.getChannel(m),
|
||||
"from": m.Tags["login"],
|
||||
"plan": m.Tags["msg-param-sub-plan"],
|
||||
}).Info("User subscribed")
|
||||
}
|
||||
log.WithFields(log.Fields(evtData)).Info("User subscribed")
|
||||
|
||||
go handleMessage(i.c, m, eventTypeSub, nil)
|
||||
go handleMessage(i.c, m, eventTypeSub, evtData)
|
||||
|
||||
case "subgift", "anonsubgift":
|
||||
log.WithFields(log.Fields{
|
||||
evtData := plugins.FieldCollection{
|
||||
"channel": i.getChannel(m),
|
||||
"from": m.Tags["login"],
|
||||
"gifted_months": m.Tags["msg-param-gift-months"],
|
||||
"plan": m.Tags["msg-param-sub-plan"],
|
||||
"to": m.Tags["msg-param-recipient-user-name"],
|
||||
}).Info("User gifted a sub")
|
||||
}
|
||||
log.WithFields(log.Fields(evtData)).Info("User gifted a sub")
|
||||
|
||||
go handleMessage(i.c, m, eventTypeSubgift, nil)
|
||||
go handleMessage(i.c, m, eventTypeSubgift, evtData)
|
||||
|
||||
case "submysterygift":
|
||||
log.WithFields(log.Fields{
|
||||
evtData := plugins.FieldCollection{
|
||||
"channel": i.getChannel(m),
|
||||
"from": m.Tags["login"],
|
||||
"number": m.Tags["msg-param-mass-gift-count"],
|
||||
"plan": m.Tags["msg-param-sub-plan"],
|
||||
}).Info("User gifted subs to the community")
|
||||
}
|
||||
log.WithFields(log.Fields(evtData)).Info("User gifted subs to the community")
|
||||
|
||||
go handleMessage(i.c, m, eventTypeSubmysterygift, evtData)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue