feat: 添加 SendForward 函数以支持消息转发,并更新 GenSendPkg 函数以处理转发逻辑
This commit is contained in:
@@ -45,7 +45,7 @@ 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)
|
||||
sendPkg := model.GenSendPkg(reply.FromMsg.UserId, reply.FromMsg.GroupInfo.GroupId, reply.ReplyMsg, false, false)
|
||||
sendPkgJson, err := json.Marshal(sendPkg)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -59,6 +59,20 @@ func (am *actionManager) SendMsg(reply *model.Reply) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
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)
|
||||
sendPkgJson, err := json.Marshal(sendPkg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = am.botConn.WriteMessage(websocket.TextMessage, sendPkgJson); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am *actionManager) DrawbackMsg(msgId int32) error {
|
||||
withDrawPkg := model.GenDrawbackPkg(msgId)
|
||||
withDrawPkgJson, err := json.Marshal(withDrawPkg)
|
||||
|
||||
Reference in New Issue
Block a user