From 91846e300f3c1b27e37e89b5fde9cc4fa7d76d00 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 1 Apr 2022 02:02:14 +0200 Subject: [PATCH] [core] Add support for "annoumcement" event type Signed-off-by: Knut Ahlers --- events.go | 2 ++ irc.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/events.go b/events.go index 7a4bc51..4dd0360 100644 --- a/events.go +++ b/events.go @@ -16,6 +16,7 @@ var ( ) var ( + eventTypeAnnouncement = ptrStr("announcement") eventTypeBan = ptrStr("ban") eventTypeBits = ptrStr("bits") eventTypeCustom = ptrStr("custom") @@ -42,6 +43,7 @@ var ( eventTypeTwitchTitleUpdate = ptrStr("title_update") knownEvents = []*string{ + eventTypeAnnouncement, eventTypeBan, eventTypeBits, eventTypeCustom, diff --git a/irc.go b/irc.go index b7433bf..c7514c5 100644 --- a/irc.go +++ b/irc.go @@ -399,6 +399,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 "announcement": + evtData := plugins.FieldCollectionFromData(map[string]any{ + "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel + "color": m.Tags["msg-param-color"], + "user": m.Tags["login"], // Compatibility to plugins.DeriveUser + }) + log.WithFields(log.Fields(evtData.Data())).Info("Announcement was made") + + go handleMessage(i.c, m, eventTypeAnnouncement, evtData) + case "giftpaidupgrade": evtData := plugins.FieldCollectionFromData(map[string]interface{}{ "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel