feat: 更新 SendMsg 和 SendForward 函数以支持字符串类型的用户ID和群组ID,增强数据处理的灵活性
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -46,7 +47,15 @@ func (am *actionManager) SendMsg(reply *model.Reply) error {
|
||||
}
|
||||
reply.ReplyMsg = fmt.Sprintf("%s%s", replyMsg.ToCQString(), reply.ReplyMsg)
|
||||
}
|
||||
sendPkg := model.GenSendPkg(reply.FromMsg.UserId, reply.FromMsg.GroupInfo.GroupId, reply.ReplyMsg, false, false)
|
||||
userID := strconv.FormatInt(reply.FromMsg.UserId, 10)
|
||||
if reply.FromMsg.UserId == 0 {
|
||||
userID = ""
|
||||
}
|
||||
groupID := strconv.FormatInt(reply.FromMsg.GroupInfo.GroupId, 10)
|
||||
if reply.FromMsg.GroupInfo.GroupId == 0 {
|
||||
groupID = ""
|
||||
}
|
||||
sendPkg := model.GenSendPkg(userID, groupID, reply.ReplyMsg, false, false)
|
||||
sendPkgJson, err := json.Marshal(sendPkg)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -63,7 +72,15 @@ func (am *actionManager) SendMsg(reply *model.Reply) error {
|
||||
func (am *actionManager) SendForward(reply *model.Reply) error {
|
||||
am.sendMtx.Lock()
|
||||
defer am.sendMtx.Unlock()
|
||||
sendPkg := model.GenSendPkg(reply.FromMsg.UserId, reply.FromMsg.GroupInfo.GroupId, reply.ReplyMsg, false, true)
|
||||
userID := strconv.FormatInt(reply.FromMsg.UserId, 10)
|
||||
if reply.FromMsg.UserId == 0 {
|
||||
userID = ""
|
||||
}
|
||||
groupID := strconv.FormatInt(reply.FromMsg.GroupInfo.GroupId, 10)
|
||||
if reply.FromMsg.GroupInfo.GroupId == 0 {
|
||||
groupID = ""
|
||||
}
|
||||
sendPkg := model.GenSendPkg(userID, groupID, reply.ReplyMsg, false, true)
|
||||
sendPkgJson, err := json.Marshal(sendPkg)
|
||||
log.Println(string(sendPkgJson))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user