From 0699f24708a699d0c2248739e85c0322a8c1e944 Mon Sep 17 00:00:00 2001 From: Asuza Date: Sun, 6 Oct 2024 14:29:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:at=E5=A4=84=E7=90=86=E4=B8=8D=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coolq/bot.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/coolq/bot.go b/coolq/bot.go index c6cac2684..2300cce5c 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -283,9 +283,23 @@ func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) (in // } // return bot.InsertGroupMessage(ret, source), nil case *message.AtElement: - self := bot.Client.GetCachedMemberInfo(bot.Client.Uin, uint32(groupID)) - if i.TargetUin == 0 && self.Permission == entity.Member { - e = message.NewText("@全体成员") + if i.TargetUin == 0 { + self := bot.Client.GetCachedMemberInfo(bot.Client.Uin, uint32(groupID)) + if self.Permission != entity.Member { + e = message.NewText("@全体成员") + } else { + continue + } + } else { + member := bot.Client.GetCachedMemberInfo(i.TargetUin, uint32(groupID)) + if member != nil { + i.TargetUid = member.Uid + if member.MemberCard != "" { + i.Display = "@" + member.MemberCard + } else { + i.Display = "@" + member.MemberName + } + } } } newElem = append(newElem, e)