From 070cb8e12cdee8a8134f1ebf914bccc0a0567f45 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 8 Dec 2024 20:09:22 +0800 Subject: [PATCH] :bug: Fix empty sender nick issue --- pkg/internal/services/events.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/internal/services/events.go b/pkg/internal/services/events.go index 7d96e3b..511a0f7 100644 --- a/pkg/internal/services/events.go +++ b/pkg/internal/services/events.go @@ -153,7 +153,7 @@ func NotifyMessageEvent(members []models.ChannelMember, event models.Event) { displayText = body.Text } case models.EventMessageDelete: - displayText = "Recalled a message" + displayText = "Deleted a message" } if len(displayText) == 0 { @@ -170,6 +170,13 @@ func NotifyMessageEvent(members []models.ChannelMember, event models.Event) { } } + if len(event.Sender.Nick) == 0 { + user, err := authkit.GetUser(gap.Nx, event.SenderID) + if err == nil { + event.Sender.Nick = user.Nick + } + } + displayTitle := fmt.Sprintf("%s (%s)", event.Sender.Nick, event.Channel.DisplayText()) if len(pendingUsers) > 0 {