[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

@ -6,15 +6,16 @@ var (
eventTypeBan = ptrStr("ban")
eventTypeBits = ptrStr("bits")
eventTypeClearChat = ptrStr("clearchat")
eventTypeJoin = ptrStr("join")
eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade")
eventTypeHost = ptrStr("host")
eventTypeJoin = ptrStr("join")
eventTypePart = ptrStr("part")
eventTypePermit = ptrStr("permit")
eventTypeRaid = ptrStr("raid")
eventTypeResub = ptrStr("resub")
eventTypeSub = ptrStr("sub")
eventTypeSubgift = ptrStr("subgift")
eventTypeSubmysterygift = ptrStr("submysterygift")
eventTypeSub = ptrStr("sub")
eventTypeTimeout = ptrStr("timeout")
eventTypeWhisper = ptrStr("whisper")
@ -27,8 +28,9 @@ var (
eventTypeBan,
eventTypeBits,
eventTypeClearChat,
eventTypeJoin,
eventTypeGiftPaidUpgrade,
eventTypeHost,
eventTypeJoin,
eventTypePart,
eventTypePermit,
eventTypeRaid,

10
irc.go
View File

@ -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

View File

@ -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!