From c0545d1d876d973130c67980cbb545f1e3cb1bac Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 31 Jul 2022 14:06:43 +0200 Subject: [PATCH] [core] Make number of subscribed months available for subgift Signed-off-by: Knut Ahlers --- irc.go | 15 ++++++++------- wiki/Events.md | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/irc.go b/irc.go index f30998d..aaa84df 100644 --- a/irc.go +++ b/irc.go @@ -464,13 +464,14 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) { case "subgift", "anonsubgift": evtData.SetFromData(map[string]interface{}{ - "from": m.Tags["login"], - "gifted_months": i.tagToNumeric(m, "msg-param-gift-months", 1), - "multi_month": i.tagToNumeric(m, "msg-param-multimonth-duration", 0), - "origin_id": m.Tags["msg-param-origin-id"], - "plan": m.Tags["msg-param-sub-plan"], - "to": m.Tags["msg-param-recipient-user-name"], - "total_gifted": i.tagToNumeric(m, "msg-param-sender-count", 0), + "from": m.Tags["login"], + "gifted_months": i.tagToNumeric(m, "msg-param-gift-months", 1), + "multi_month": i.tagToNumeric(m, "msg-param-multimonth-duration", 0), + "origin_id": m.Tags["msg-param-origin-id"], + "plan": m.Tags["msg-param-sub-plan"], + "subscribed_months": i.tagToNumeric(m, "msg-param-months", 0), + "to": m.Tags["msg-param-recipient-user-name"], + "total_gifted": i.tagToNumeric(m, "msg-param-sender-count", 0), }) log.WithFields(log.Fields(evtData.Data())).Info("User gifted a sub") diff --git a/wiki/Events.md b/wiki/Events.md index a3139f5..67c5f86 100644 --- a/wiki/Events.md +++ b/wiki/Events.md @@ -174,6 +174,7 @@ Fields: - `gifted_months` - Number of months the user gifted - `origin_id` - ID unique to the gift-event (can be used to match `subgift` events to corresponding `submysterygift` event) - `plan` - The sub-plan they are using (`1000` = T1, `2000` = T2, `3000` = T3, `Prime`) +- `subscribed_months` - How long the recipient has been subscribed - `to` - The user who received the sub - `username` - The login-name of the user who gifted the subscription