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,