mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 08:40:01 +00:00
[core] Add support for "annoumcement" event type
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
4c5fcc9e91
commit
91846e300f
2 changed files with 12 additions and 0 deletions
|
@ -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
10
irc.go
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue