mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: send forward msg
This commit is contained in:
parent
24a1ffd652
commit
af9092d7c7
@ -18,10 +18,17 @@ export class GoCQHTTGetForwardMsgAction extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
||||||
|
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
const rootMsg = await dbUtil.getMsgByLongId( payload.id || payload.message_id);
|
const msgId = payload.message_id || payload.id;
|
||||||
|
if (!msgId) {
|
||||||
|
throw Error('message_id is required');
|
||||||
|
}
|
||||||
|
let rootMsg = await dbUtil.getMsgByLongId(msgId);
|
||||||
|
if (!rootMsg) {
|
||||||
|
rootMsg = await dbUtil.getMsgByShortId(parseInt(msgId));
|
||||||
if (!rootMsg){
|
if (!rootMsg){
|
||||||
throw Error('msg not found');
|
throw Error('msg not found');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const data = await NTQQMsgApi.getMultiMsg({
|
const data = await NTQQMsgApi.getMultiMsg({
|
||||||
chatType: rootMsg.chatType,
|
chatType: rootMsg.chatType,
|
||||||
peerUid: rootMsg.peerUid
|
peerUid: rootMsg.peerUid
|
||||||
|
@ -333,7 +333,13 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
if (this.getSpecialMsgNum(payload, OB11MessageDataType.node)) {
|
if (this.getSpecialMsgNum(payload, OB11MessageDataType.node)) {
|
||||||
try {
|
try {
|
||||||
const returnMsg = await this.handleForwardNode(peer, messages as OB11MessageNode[], group);
|
const returnMsg = await this.handleForwardNode(peer, messages as OB11MessageNode[], group);
|
||||||
return { message_id: returnMsg!.id! };
|
if (returnMsg){
|
||||||
|
const msgShortId =await dbUtil.addMsg(returnMsg!, false);
|
||||||
|
return { message_id: msgShortId };
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw Error('发送转发消息失败');
|
||||||
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
throw Error('发送转发消息失败 ' + e.toString());
|
throw Error('发送转发消息失败 ' + e.toString());
|
||||||
}
|
}
|
||||||
@ -510,7 +516,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
throw Error('转发消息失败,生成节点为空');
|
throw Error('转发消息失败,生成节点为空');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
log('开发转发', nodeMsgIds);
|
log('开发转发', srcPeer, destPeer, nodeMsgIds);
|
||||||
return await NTQQMsgApi.multiForwardMsg(srcPeer!, destPeer, nodeMsgIds);
|
return await NTQQMsgApi.multiForwardMsg(srcPeer!, destPeer, nodeMsgIds);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('forward failed', e);
|
log('forward failed', e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user