Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
  • Loading branch information
RikaCelery and fumiama authored Oct 13, 2024
1 parent 2c5cfea commit 8b77550
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 8b77550

Please sign in to comment.