From 8b775507539c6f1562ecbb4125d01f76711458a6 Mon Sep 17 00:00:00 2001 From: RikaCelery <94585272+RikaCelery@users.noreply.github.com> Date: Sun, 13 Oct 2024 17:57:08 +0800 Subject: [PATCH] optimize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com> --- pattern.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pattern.go b/pattern.go index e0e0074..4d571db 100644 --- a/pattern.go +++ b/pattern.go @@ -25,18 +25,11 @@ func (p *Pattern) AsRule() Rule { if ctx.Event.Message[i-1].Type == "reply" && ctx.Event.Message[i].Type == "at" { // [reply][at] reply := ctx.GetMessage(ctx.Event.Message[i-1].Data["id"]) - if reply.MessageID.ID() == 0 || reply.Sender == nil || reply.Sender.ID == 0 { - // failed to get history message - msgs = append(msgs, ctx.Event.Message[i]) + if reply.MessageID.ID() != 0 && reply.Sender != nil && reply.Sender.ID != 0 && strconv.FormatInt(reply.Sender.ID, 10) == ctx.Event.Message[i].Data["qq"] { continue } - if strconv.FormatInt(reply.Sender.ID, 10) != ctx.Event.Message[i].Data["qq"] { - // @ other user in reply - msgs = append(msgs, ctx.Event.Message[i]) - } - } else { - msgs = append(msgs, ctx.Event.Message[i]) } + msgs = append(msgs, ctx.Event.Message[i]) } return patternMatch(ctx, *p, msgs) }