mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
[core] Remove "host" related functionality
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3dc60b62b8
commit
737338dc72
2 changed files with 2 additions and 37 deletions
|
@ -25,7 +25,6 @@ var (
|
||||||
eventTypeDelete = ptrStr("delete")
|
eventTypeDelete = ptrStr("delete")
|
||||||
eventTypeFollow = ptrStr("follow")
|
eventTypeFollow = ptrStr("follow")
|
||||||
eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade")
|
eventTypeGiftPaidUpgrade = ptrStr("giftpaidupgrade")
|
||||||
eventTypeHost = ptrStr("host")
|
|
||||||
eventTypeJoin = ptrStr("join")
|
eventTypeJoin = ptrStr("join")
|
||||||
eventTypeOutboundRaid = ptrStr("outbound_raid")
|
eventTypeOutboundRaid = ptrStr("outbound_raid")
|
||||||
eventTypePart = ptrStr("part")
|
eventTypePart = ptrStr("part")
|
||||||
|
@ -55,7 +54,6 @@ var (
|
||||||
eventTypeDelete,
|
eventTypeDelete,
|
||||||
eventTypeFollow,
|
eventTypeFollow,
|
||||||
eventTypeGiftPaidUpgrade,
|
eventTypeGiftPaidUpgrade,
|
||||||
eventTypeHost,
|
|
||||||
eventTypeJoin,
|
eventTypeJoin,
|
||||||
eventTypeOutboundRaid,
|
eventTypeOutboundRaid,
|
||||||
eventTypePart,
|
eventTypePart,
|
||||||
|
|
37
irc.go
37
irc.go
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -20,8 +19,6 @@ import (
|
||||||
var (
|
var (
|
||||||
rawMessageHandlers []plugins.RawMessageHandlerFunc
|
rawMessageHandlers []plugins.RawMessageHandlerFunc
|
||||||
rawMessageHandlersLock sync.Mutex
|
rawMessageHandlersLock sync.Mutex
|
||||||
|
|
||||||
hostNotificationRegex = regexp.MustCompile(`^(?P<actor>\w+) is now(?: auto)? hosting you(?: for(?: up to)? (?P<amount>[0-9]+) viewers)?.$`)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func notifyRawMessageHandlers(m *irc.Message) error {
|
func notifyRawMessageHandlers(m *irc.Message) error {
|
||||||
|
@ -314,15 +311,8 @@ func (i ircHandler) handleTwitchNotice(m *irc.Message) {
|
||||||
// Notices SHOULD have msg-id tags...
|
// Notices SHOULD have msg-id tags...
|
||||||
log.WithField("msg", m).Warn("Received notice without msg-id")
|
log.WithField("msg", m).Warn("Received notice without msg-id")
|
||||||
|
|
||||||
case "host_success", "host_success_viewers":
|
default:
|
||||||
log.WithField("trailing", m.Trailing()).Warn("Incoming host")
|
log.WithField("id", m.Tags["msg-id"]).Debug("unhandled notice received")
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,29 +335,6 @@ func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) {
|
||||||
configLock.RUnlock()
|
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") {
|
if strings.HasPrefix(m.Trailing(), "!permit") {
|
||||||
i.handlePermit(m)
|
i.handlePermit(m)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue