fix: setMsg

This commit is contained in:
手瓜一十雪 2024-07-30 16:34:33 +08:00
parent a379ffd0f2
commit 55d5072f46
4 changed files with 11 additions and 8 deletions

View File

@ -159,7 +159,7 @@ export interface NodeIKernelRichMediaService {
fileName: string, fileName: string,
fileSize: string, fileSize: string,
fileModelId: string fileModelId: string
}[]): unknown; }[]): Promise<unknown>;
downloadFileByUrlList(fileDownloadTyp: UrlFileDownloadType, urlList: Array<string>): unknown; downloadFileByUrlList(fileDownloadTyp: UrlFileDownloadType, urlList: Array<string>): unknown;

View File

@ -170,7 +170,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
// log("send msg:", peer, sendElements) // log("send msg:", peer, sendElements)
const { sendElements, deleteAfterSentFiles } = await createSendElements(messages, group); const { sendElements, deleteAfterSentFiles } = await createSendElements(messages, group);
//console.log(peer, JSON.stringify(sendElements,null,2)); console.log(peer, JSON.stringify(sendElements,null,2));
const returnMsg = await sendMsg(peer, sendElements, deleteAfterSentFiles); const returnMsg = await sendMsg(peer, sendElements, deleteAfterSentFiles);
return { message_id: returnMsg!.id! }; return { message_id: returnMsg!.id! };
} }

View File

@ -7,8 +7,8 @@ import { MessageUnique } from '@/common/utils/MessageUnique';
const SchemaData = { const SchemaData = {
type: 'object', type: 'object',
properties: { properties: {
message_id: { type: ['string','number'] }, message_id: { type: ['string', 'number'] },
emoji_id: { type: ['string','number'] } emoji_id: { type: ['string', 'number'] }
}, },
required: ['message_id', 'emoji_id'] required: ['message_id', 'emoji_id']
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
@ -23,10 +23,13 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
if (!msg) { if (!msg) {
throw new Error('msg not found'); throw new Error('msg not found');
} }
if (!payload.emoji_id){ if (!payload.emoji_id) {
throw new Error('emojiId not found'); throw new Error('emojiId not found');
} }
const msgSeq = (await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList[0].msgSeq; const msgData = (await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList;
return await NTQQMsgApi.setEmojiLike(msg.Peer, msgSeq, payload.emoji_id.toString(), true); if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
throw new Error('find msg by msgid error');
}
return await NTQQMsgApi.setEmojiLike(msg.Peer, msgData[0].msgSeq, payload.emoji_id.toString(), true);
} }
} }

View File

@ -28,7 +28,7 @@ if (process.env.NAPCAT_BUILDSYS == 'linux') {
} }
startScripts = ['./script/dbghelp.dll', './script/BootWay05-utf8.ps1', './script/BootWay05.ps1', './script/napcat-9912.ps1', './script/napcat-9912-utf8.ps1', './script/napcat-9912.bat', './script/napcat-9912-utf8.bat']; startScripts = ['./script/dbghelp.dll', './script/BootWay05-utf8.ps1', './script/BootWay05.ps1', './script/napcat-9912.ps1', './script/napcat-9912-utf8.ps1', './script/napcat-9912.bat', './script/napcat-9912-utf8.bat'];
} else { } else {
startScripts = ['./script/napcat.sh', './script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1', './script/napcat-9912.ps1', './script/napcat-9912-utf8.ps1', './script/napcat-9912.bat', './script/napcat-9912-utf8.bat']; startScripts = ['./script/BootWay05-utf8.ps1', './script/BootWay05.ps1', './script/napcat.sh', './script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1', './script/napcat-9912.ps1', './script/napcat-9912-utf8.ps1', './script/napcat-9912.bat', './script/napcat-9912-utf8.bat'];
} }
const baseConfigPlugin: PluginOption[] = [ const baseConfigPlugin: PluginOption[] = [