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) {
|
func getMyRecentScore(msg model.Message) (reply *model.Reply) {
|
||||||
count := 1
|
count := 1
|
||||||
scoreMsg := ""
|
scoreMsg := []any{}
|
||||||
if len(msg.RawMsg) > len("最新bl ") {
|
if len(msg.RawMsg) > len("最新bl ") {
|
||||||
var err error
|
var err error
|
||||||
count, err = strconv.Atoi(msg.RawMsg[len("最新bl "):])
|
count, err = strconv.Atoi(msg.RawMsg[len("最新bl "):])
|
||||||
@ -272,7 +272,13 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) {
|
|||||||
File: coverImageMap[record.SongHash],
|
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
|
userName = record.Name
|
||||||
recordCount++
|
recordCount++
|
||||||
}
|
}
|
||||||
@ -287,15 +293,20 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) {
|
|||||||
}
|
}
|
||||||
//如果消息行数太多,使用合并转发
|
//如果消息行数太多,使用合并转发
|
||||||
if len(records) > 5 {
|
if len(records) > 5 {
|
||||||
nodeMsg := util.NewSelfNodeMessage(&message.TextMessage{
|
nodeMsg := util.NewSelfNodeMessage(append(
|
||||||
Type: "text",
|
[]any{
|
||||||
Data: message.TextMessageData{
|
&message.TextMessage{
|
||||||
Text: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n" + scoreMsg,
|
Type: "text",
|
||||||
|
Data: message.TextMessageData{
|
||||||
|
Text: "玩家 " + userName + " 的" + strconv.Itoa(recordCount) + "条最近记录为:\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
scoreMsg...,
|
||||||
|
)...)
|
||||||
action.ActionManager.SendForward(
|
action.ActionManager.SendForward(
|
||||||
&model.Reply{
|
&model.Reply{
|
||||||
ReplyMsg: []any{&nodeMsg},
|
ReplyMsg: []any{nodeMsg},
|
||||||
ReferOriginMsg: false,
|
ReferOriginMsg: false,
|
||||||
FromMsg: msg,
|
FromMsg: msg,
|
||||||
},
|
},
|
||||||
@ -303,7 +314,17 @@ func getMyRecentScore(msg model.Message) (reply *model.Reply) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &model.Reply{
|
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,
|
ReferOriginMsg: true,
|
||||||
FromMsg: msg,
|
FromMsg: msg,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user