refactor: 优化 SendMsg 函数中的消息构建逻辑,使用切片拼接替代字符串格式化,提升性能和可读性
This commit is contained in:
parent
1a31652751
commit
5f8609bef2
@ -2,7 +2,6 @@ package action
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
@ -45,7 +44,7 @@ func (am *actionManager) SendMsg(reply *model.Reply) error {
|
||||
ID: int(reply.FromMsg.OriginMsgId),
|
||||
},
|
||||
}
|
||||
reply.ReplyMsg = fmt.Sprintf("%s%s", replyMsg.ToCQString(), reply.ReplyMsg)
|
||||
reply.ReplyMsg = append([]any{replyMsg}, reply.ReplyMsg)
|
||||
}
|
||||
userID := strconv.FormatInt(reply.FromMsg.UserId, 10)
|
||||
if reply.FromMsg.UserId == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user