diff --git a/events.go b/events.go index aef6d84..ddb1ee9 100644 --- a/events.go +++ b/events.go @@ -3,20 +3,21 @@ package main func ptrStr(s string) *string { return &s } var ( - eventTypeBan = ptrStr("ban") - eventTypeBits = ptrStr("bits") - eventTypeClearChat = ptrStr("clearchat") - eventTypeJoin = ptrStr("join") - eventTypeHost = ptrStr("host") - eventTypePart = ptrStr("part") - eventTypePermit = ptrStr("permit") - eventTypeRaid = ptrStr("raid") - eventTypeResub = ptrStr("resub") - eventTypeSub = ptrStr("sub") - eventTypeSubgift = ptrStr("subgift") - eventTypeSubmysterygift = ptrStr("submysterygift") - eventTypeTimeout = ptrStr("timeout") - eventTypeWhisper = ptrStr("whisper") + eventTypeBan = ptrStr("ban") + eventTypeBits = ptrStr("bits") + eventTypeClearChat = ptrStr("clearchat") + eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade") + eventTypeHost = ptrStr("host") + eventTypeJoin = ptrStr("join") + eventTypePart = ptrStr("part") + eventTypePermit = ptrStr("permit") + eventTypeRaid = ptrStr("raid") + eventTypeResub = ptrStr("resub") + eventTypeSubgift = ptrStr("subgift") + eventTypeSubmysterygift = ptrStr("submysterygift") + eventTypeSub = ptrStr("sub") + eventTypeTimeout = ptrStr("timeout") + eventTypeWhisper = ptrStr("whisper") eventTypeTwitchCategoryUpdate = ptrStr("category_update") eventTypeTwitchStreamOffline = ptrStr("stream_offline") @@ -27,8 +28,9 @@ var ( eventTypeBan, eventTypeBits, eventTypeClearChat, - eventTypeJoin, + eventTypeGiftPaidUpgrade, eventTypeHost, + eventTypeJoin, eventTypePart, eventTypePermit, eventTypeRaid, diff --git a/irc.go b/irc.go index 0fa0b90..64fd700 100644 --- a/irc.go +++ b/irc.go @@ -321,6 +321,16 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) { // Notices SHOULD have msg-id tags... 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": evtData := plugins.FieldCollectionFromData(map[string]interface{}{ "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel diff --git a/wiki/Events.md b/wiki/Events.md index c3f1765..d9da712 100644 --- a/wiki/Events.md +++ b/wiki/Events.md @@ -41,6 +41,16 @@ Fields: - `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` 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!