[core] Add support for "annoumcement" event type

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-04-01 02:02:14 +02:00
parent 4c5fcc9e91
commit 91846e300f
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 12 additions and 0 deletions

View file

@ -16,6 +16,7 @@ var (
) )
var ( var (
eventTypeAnnouncement = ptrStr("announcement")
eventTypeBan = ptrStr("ban") eventTypeBan = ptrStr("ban")
eventTypeBits = ptrStr("bits") eventTypeBits = ptrStr("bits")
eventTypeCustom = ptrStr("custom") eventTypeCustom = ptrStr("custom")
@ -42,6 +43,7 @@ var (
eventTypeTwitchTitleUpdate = ptrStr("title_update") eventTypeTwitchTitleUpdate = ptrStr("title_update")
knownEvents = []*string{ knownEvents = []*string{
eventTypeAnnouncement,
eventTypeBan, eventTypeBan,
eventTypeBits, eventTypeBits,
eventTypeCustom, eventTypeCustom,

10
irc.go
View file

@ -399,6 +399,16 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
// Notices SHOULD have msg-id tags... // Notices SHOULD have msg-id tags...
log.WithField("msg", m).Warn("Received usernotice without msg-id") 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": case "giftpaidupgrade":
evtData := plugins.FieldCollectionFromData(map[string]interface{}{ evtData := plugins.FieldCollectionFromData(map[string]interface{}{
"channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel