From 380dc9fcf7e2f2f1f5e997ff68718e436c07a70d Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Mon, 5 May 2025 03:37:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=80=E6=96=B0bl=E9=95=BF=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=BD=BF=E7=94=A8=E5=90=88=E5=B9=B6=E8=BD=AC=E5=8F=91?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/beatleader/beatleader.go | 39 ++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/handler/beatleader/beatleader.go b/handler/beatleader/beatleader.go index efc86de..38ca0fc 100644 --- a/handler/beatleader/beatleader.go +++ b/handler/beatleader/beatleader.go @@ -219,7 +219,7 @@ func unbindBL(msg model.Message) (reply *model.Reply) { func getMyRecentScore(msg model.Message) (reply *model.Reply) { count := 1 - scoreMsg := "" + scoreMsg := []any{} if len(msg.RawMsg) > len("最新bl ") { var err error count, err = strconv.Atoi(msg.RawMsg[len("最新bl "):]) @@ -272,7 +272,13 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) { File: coverImageMap[record.SongHash], }, } - scoreMsg += imageMsg.ToCQString() + record.ToString() + "\n" + textMsg := message.TextMessage{ + Type: "text", + Data: message.TextMessageData{ + Text: record.ToString(), + }, + } + scoreMsg = append(scoreMsg, imageMsg, textMsg) userName = record.Name recordCount++ } @@ -287,15 +293,20 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) { } //如果消息行数太多,使用合并转发 if len(records) > 5 { - nodeMsg := util.NewSelfNodeMessage(&message.TextMessage{ - Type: "text", - Data: message.TextMessageData{ - Text: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, + nodeMsg := util.NewSelfNodeMessage(append( + []any{ + &message.TextMessage{ + Type: "text", + Data: message.TextMessageData{ + Text: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n", + }, + }, }, - }) + scoreMsg..., + )...) action.ActionManager.SendForward( &model.Reply{ - ReplyMsg: []any{&nodeMsg}, + ReplyMsg: []any{nodeMsg}, ReferOriginMsg: false, FromMsg: msg, }, @@ -303,7 +314,17 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) { return nil } return &model.Reply{ - ReplyMsg: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg, + ReplyMsg: append( + []any{ + message.TextMessage{ + Type: "text", + Data: message.TextMessageData{ + Text: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n", + }, + }, + }, + scoreMsg..., + ), ReferOriginMsg: true, FromMsg: msg, }