[core] Add giftpaidupgrade event

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-11-19 19:54:53 +01:00
parent 8ba6d2ef08
commit c6fa5a9df9
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
3 changed files with 37 additions and 15 deletions

View file

@ -3,20 +3,21 @@ package main
func ptrStr(s string) *string { return &s } func ptrStr(s string) *string { return &s }
var ( var (
eventTypeBan = ptrStr("ban") eventTypeBan = ptrStr("ban")
eventTypeBits = ptrStr("bits") eventTypeBits = ptrStr("bits")
eventTypeClearChat = ptrStr("clearchat") eventTypeClearChat = ptrStr("clearchat")
eventTypeJoin = ptrStr("join") eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade")
eventTypeHost = ptrStr("host") eventTypeHost = ptrStr("host")
eventTypePart = ptrStr("part") eventTypeJoin = ptrStr("join")
eventTypePermit = ptrStr("permit") eventTypePart = ptrStr("part")
eventTypeRaid = ptrStr("raid") eventTypePermit = ptrStr("permit")
eventTypeResub = ptrStr("resub") eventTypeRaid = ptrStr("raid")
eventTypeSub = ptrStr("sub") eventTypeResub = ptrStr("resub")
eventTypeSubgift = ptrStr("subgift") eventTypeSubgift = ptrStr("subgift")
eventTypeSubmysterygift = ptrStr("submysterygift") eventTypeSubmysterygift = ptrStr("submysterygift")
eventTypeTimeout = ptrStr("timeout") eventTypeSub = ptrStr("sub")
eventTypeWhisper = ptrStr("whisper") eventTypeTimeout = ptrStr("timeout")
eventTypeWhisper = ptrStr("whisper")
eventTypeTwitchCategoryUpdate = ptrStr("category_update") eventTypeTwitchCategoryUpdate = ptrStr("category_update")
eventTypeTwitchStreamOffline = ptrStr("stream_offline") eventTypeTwitchStreamOffline = ptrStr("stream_offline")
@ -27,8 +28,9 @@ var (
eventTypeBan, eventTypeBan,
eventTypeBits, eventTypeBits,
eventTypeClearChat, eventTypeClearChat,
eventTypeJoin, eventTypeGiftPaidUpgrade,
eventTypeHost, eventTypeHost,
eventTypeJoin,
eventTypePart, eventTypePart,
eventTypePermit, eventTypePermit,
eventTypeRaid, eventTypeRaid,

10
irc.go
View file

@ -321,6 +321,16 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
// Notices SHOULD have msg-id tags... // Notices SHOULD have msg-id tags...
log.WithField("msg", m).Warn("Received usernotice without msg-id") log.WithField("msg", m).Warn("Received usernotice without msg-id")
case "giftpaidupgrade":
evtData := plugins.FieldCollectionFromData(map[string]interface{}{
"channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel
"gifter": m.Tags["msg-param-sender-login"],
"user": m.Tags["login"], // Compatibility to plugins.DeriveUser
})
log.WithFields(log.Fields(evtData.Data())).Info("User upgraded to paid sub")
go handleMessage(i.c, m, eventTypeGiftPaidUpgrade, evtData)
case "raid": case "raid":
evtData := plugins.FieldCollectionFromData(map[string]interface{}{ evtData := plugins.FieldCollectionFromData(map[string]interface{}{
"channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel

View file

@ -41,6 +41,16 @@ Fields:
- `channel` - The channel the event occurred in - `channel` - The channel the event occurred in
## `giftpaidupgrade`
User upgraded their gifted subscription into a paid one. This event does not contain any details about the tier of the paid subscription.
Fields:
- `channel` - The channel the event occurred in
- `gifter` - The login-name of the user who gifted the subscription
- `username` - The login-name of the user who upgraded their subscription
## `join` ## `join`
User joined the channel-chat. This is **NOT** an indicator they are viewing, the event is **NOT** reliably sent when the user really joined the chat. The event will be sent with some delay after they join the chat and is sometimes repeated multiple times during their stay. So **DO NOT** use this to greet users! User joined the channel-chat. This is **NOT** an indicator they are viewing, the event is **NOT** reliably sent when the user really joined the chat. The event will be sent with some delay after they join the chat and is sometimes repeated multiple times during their stay. So **DO NOT** use this to greet users!