feat: 最新bl长结果使用合并转发发送
This commit is contained in:
parent
c8b67a257a
commit
380dc9fcf7
@ -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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user