From 737338dc72b73a5fb30575b39bc93b2ede6a85d8 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 8 Apr 2023 02:03:40 +0200 Subject: [PATCH] [core] Remove "host" related functionality Signed-off-by: Knut Ahlers --- events.go | 2 -- irc.go | 37 ++----------------------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/events.go b/events.go index 1cc26b9..c627f71 100644 --- a/events.go +++ b/events.go @@ -25,7 +25,6 @@ var ( eventTypeDelete = ptrStr("delete") eventTypeFollow = ptrStr("follow") eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade") - eventTypeHost = ptrStr("host") eventTypeJoin = ptrStr("join") eventTypeOutboundRaid = ptrStr("outbound_raid") eventTypePart = ptrStr("part") @@ -55,7 +54,6 @@ var ( eventTypeDelete, eventTypeFollow, eventTypeGiftPaidUpgrade, - eventTypeHost, eventTypeJoin, eventTypeOutboundRaid, eventTypePart, diff --git a/irc.go b/irc.go index bbb1b8f..b901b20 100644 --- a/irc.go +++ b/irc.go @@ -3,7 +3,6 @@ package main import ( "crypto/tls" "fmt" - "regexp" "strconv" "strings" "sync" @@ -20,8 +19,6 @@ import ( var ( rawMessageHandlers []plugins.RawMessageHandlerFunc rawMessageHandlersLock sync.Mutex - - hostNotificationRegex = regexp.MustCompile(`^(?P\w+) is now(?: auto)? hosting you(?: for(?: up to)? (?P[0-9]+) viewers)?.$`) ) func notifyRawMessageHandlers(m *irc.Message) error { @@ -314,15 +311,8 @@ func (i ircHandler) handleTwitchNotice(m *irc.Message) { // Notices SHOULD have msg-id tags... log.WithField("msg", m).Warn("Received notice without msg-id") - case "host_success", "host_success_viewers": - log.WithField("trailing", m.Trailing()).Warn("Incoming host") - - fields := plugins.FieldCollectionFromData(map[string]interface{}{ - eventFieldChannel: i.getChannel(m), // Compatibility to plugins.DeriveChannel - eventFieldUserName: m.User, // Compatibility to plugins.DeriveUser - }) - go handleMessage(i.c, m, eventTypeHost, fields) - + default: + log.WithField("id", m.Tags["msg-id"]).Debug("unhandled notice received") } } @@ -345,29 +335,6 @@ func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) { configLock.RUnlock() } - // Handle the jtv host message for hosts - if m.User == "jtv" && hostNotificationRegex.MatchString(m.Trailing()) { - matches := hostNotificationRegex.FindStringSubmatch(m.Trailing()) - if matches[2] == "" { - matches[2] = "0" - } - - fields := plugins.FieldCollectionFromData(map[string]interface{}{ - eventFieldChannel: fmt.Sprintf("#%s", i.user), - "from": matches[1], - "viewerCount": 0, - }) - - if v, err := strconv.Atoi(matches[2]); err == nil { - fields.Set("viewerCount", v) - } - - log.WithFields(log.Fields(fields.Data())).Info("Incoming Host (jtv announce)") - - go handleMessage(i.c, m, eventTypeHost, fields) - return - } - if strings.HasPrefix(m.Trailing(), "!permit") { i.handlePermit(m) return