feat: 在消息处理逻辑中添加合并转发功能,当记录条数超过 5 条时使用合并转发,提升用户体验
This commit is contained in:
parent
5bb07950f6
commit
77a506917e
@ -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
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user