🐛 Fix empty sender nick issue

This commit is contained in:
LittleSheep 2024-12-08 20:09:22 +08:00
parent 364fda8a55
commit 070cb8e12c

View File

@ -153,7 +153,7 @@ func NotifyMessageEvent(members []models.ChannelMember, event models.Event) {
displayText = body.Text displayText = body.Text
} }
case models.EventMessageDelete: case models.EventMessageDelete:
displayText = "Recalled a message" displayText = "Deleted a message"
} }
if len(displayText) == 0 { 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()) displayTitle := fmt.Sprintf("%s (%s)", event.Sender.Nick, event.Channel.DisplayText())
if len(pendingUsers) > 0 { if len(pendingUsers) > 0 {