[core] Use empty resub message when none given

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-04-17 13:44:47 +02:00
parent f674735689
commit 585161930d
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

8
irc.go
View file

@ -434,10 +434,16 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
go handleMessage(i.c, m, eventTypeRaid, evtData)
case "resub":
message := m.Trailing()
if message == i.getChannel(m) {
// If no message is given, Trailing yields the channel name
message = ""
}
evtData := plugins.FieldCollectionFromData(map[string]interface{}{
"channel": i.getChannel(m), // Compatibility to plugins.DeriveChannel
"from": m.Tags["login"],
"message": m.Trailing(),
"message": message,
"subscribed_months": m.Tags["msg-param-cumulative-months"],
"plan": m.Tags["msg-param-sub-plan"],
"user": m.Tags["login"], // Compatibility to plugins.DeriveUser