From 77a506917e1a0e4b7fe5cf48affaf619f9eb12ab Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sun, 4 May 2025 23:24:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E6=B6=88=E6=81=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=BD=AC=E5=8F=91=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9D=A1=E6=95=B0=E8=B6=85=E8=BF=87=205=20?= =?UTF-8?q?=E6=9D=A1=E6=97=B6=E4=BD=BF=E7=94=A8=E5=90=88=E5=B9=B6=E8=BD=AC?= =?UTF-8?q?=E5=8F=91=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action.go | 2 +- handler/beatleader/beatleader.go | 12 ++++++++++++ handler/scoresaber/score.go | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/action/action.go b/action/action.go index eb9c2d8..46653ed 100644 --- a/action/action.go +++ b/action/action.go @@ -86,7 +86,7 @@ func (am *actionManager) SendForward(reply *model.Reply) error { if err != nil { return err } - log.Default().Printf("\033[32m↑\033[0m:%s", string(sendPkgJson)) + log.Default().Printf("\033[32m↑\033[0m(forward):%s", string(sendPkgJson)) if err = am.botConn.WriteMessage(websocket.TextMessage, sendPkgJson); err != nil { return err } diff --git a/handler/beatleader/beatleader.go b/handler/beatleader/beatleader.go index d648d47..1730a45 100644 --- a/handler/beatleader/beatleader.go +++ b/handler/beatleader/beatleader.go @@ -7,6 +7,7 @@ import ( "strings" "sync" + "git.lxtend.com/qqbot/action" "git.lxtend.com/qqbot/constants" "git.lxtend.com/qqbot/handler" "git.lxtend.com/qqbot/message" @@ -284,6 +285,17 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) { FromMsg: msg, } } + //如果消息行数太多,使用合并转发 + if recordCount > 5 { + action.ActionManager.SendForward( + &model.Reply{ + ReplyMsg: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, + ReferOriginMsg: true, + FromMsg: msg, + }, + ) + return nil + } return &model.Reply{ ReplyMsg: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, ReferOriginMsg: true, diff --git a/handler/scoresaber/score.go b/handler/scoresaber/score.go index a806890..2989283 100644 --- a/handler/scoresaber/score.go +++ b/handler/scoresaber/score.go @@ -7,6 +7,7 @@ import ( "strings" "sync" + "git.lxtend.com/qqbot/action" "git.lxtend.com/qqbot/constants" "git.lxtend.com/qqbot/handler" "git.lxtend.com/qqbot/message" @@ -297,6 +298,17 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) { FromMsg: msg, } } + //如果消息行数太多,使用合并转发 + if recordCount > 5 { + action.ActionManager.SendForward( + &model.Reply{ + ReplyMsg: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, + ReferOriginMsg: true, + FromMsg: msg, + }, + ) + return nil + } return &model.Reply{ ReplyMsg: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, ReferOriginMsg: true,