From 250a07f5b8b2a7137f917b594e062358262a82de Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 23 Dec 2021 14:16:01 +0100 Subject: [PATCH] [core] log bits from chat message Signed-off-by: Knut Ahlers --- irc.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/irc.go b/irc.go index ec08260..72d37b6 100644 --- a/irc.go +++ b/irc.go @@ -331,9 +331,15 @@ func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) { } if bits, err := strconv.ParseInt(string(m.Tags["bits"]), 10, 64); err == nil { - go handleMessage(i.c, m, eventTypeBits, plugins.FieldCollectionFromData(map[string]interface{}{ - "bits": bits, - })) + fields := plugins.FieldCollectionFromData(map[string]interface{}{ + "bits": bits, + "channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel + "user": m.Tags["login"], // Compatibility to plugins.DeriveUser + }) + + log.WithFields(log.Fields(fields.Data())).Info("User spent bits in chat message") + + go handleMessage(i.c, m, eventTypeBits, fields) } go handleMessage(i.c, m, nil, nil)