mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1dcf2ef0c6 | ||
![]() |
3642c65e8c | ||
![]() |
40e105994a | ||
![]() |
f2ee973882 |
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "4.2.0",
|
"version": "4.2.2",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "4.2.0",
|
"version": "4.2.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
|
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
|
||||||
"build:shell": "npm run build:webui && vite build --mode shell || exit 1",
|
"build:shell": "npm run build:webui && vite build --mode shell || exit 1",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '4.2.0';
|
export const napCatVersion = '4.2.2';
|
||||||
|
@@ -3,12 +3,12 @@ import { PicType } from '../types';
|
|||||||
export async function getFileTypeForSendType(picPath: string): Promise<PicType> {
|
export async function getFileTypeForSendType(picPath: string): Promise<PicType> {
|
||||||
const fileTypeResult = (await fileType.fileTypeFromFile(picPath))?.ext ?? 'jpg';
|
const fileTypeResult = (await fileType.fileTypeFromFile(picPath))?.ext ?? 'jpg';
|
||||||
const picTypeMap: { [key: string]: PicType } = {
|
const picTypeMap: { [key: string]: PicType } = {
|
||||||
'webp': PicType.NEWPIC_WEBP,
|
//'webp': PicType.NEWPIC_WEBP,
|
||||||
'gif': PicType.NEWPIC_GIF,
|
'gif': PicType.NEWPIC_GIF,
|
||||||
'png': PicType.NEWPIC_APNG,
|
// 'png': PicType.NEWPIC_APNG,
|
||||||
'jpg': PicType.NEWPIC_JPEG,
|
// 'jpg': PicType.NEWPIC_JPEG,
|
||||||
'jpeg': PicType.NEWPIC_JPEG,
|
// 'jpeg': PicType.NEWPIC_JPEG,
|
||||||
'bmp': PicType.NEWPIC_BMP,
|
// 'bmp': PicType.NEWPIC_BMP,
|
||||||
};
|
};
|
||||||
return picTypeMap[fileTypeResult] ?? PicType.NEWPIC_JPEG;
|
return picTypeMap[fileTypeResult] ?? PicType.NEWPIC_JPEG;
|
||||||
}
|
}
|
@@ -213,7 +213,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
if (networkChange === OB11NetworkReloadType.NetWorkClose) {
|
if (networkChange === OB11NetworkReloadType.NetWorkClose) {
|
||||||
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
||||||
}
|
}
|
||||||
} else if(adapterConfig.enable) {
|
} else if (adapterConfig.enable) {
|
||||||
const newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this.actions);
|
const newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this.actions);
|
||||||
await this.networkManager.registerAdapterAndOpen(newAdapter);
|
await this.networkManager.registerAdapterAndOpen(newAdapter);
|
||||||
}
|
}
|
||||||
@@ -266,23 +266,30 @@ export class NapCatOneBot11Adapter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
msgListener.onAddSendMsg = async (msg) => {
|
msgListener.onAddSendMsg = async (msg) => {
|
||||||
if (msg.sendStatus == SendStatusType.KSEND_STATUS_SENDING) {
|
try {
|
||||||
await this.core.eventWrapper.registerListen('NodeIKernelMsgListener/onMsgInfoListUpdate', (msgList: RawMessage[]) => {
|
if (msg.sendStatus == SendStatusType.KSEND_STATUS_SENDING) {
|
||||||
const report = msgList.find((e) =>
|
const [updatemsgs] = await this.core.eventWrapper.registerListen('NodeIKernelMsgListener/onMsgInfoListUpdate', (msgList: RawMessage[]) => {
|
||||||
e.senderUin == this.core.selfInfo.uin && e.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS && e.msgId === msg.msgId
|
const report = msgList.find((e) =>
|
||||||
);
|
e.senderUin == this.core.selfInfo.uin && e.sendStatus !== SendStatusType.KSEND_STATUS_SENDING && e.msgId === msg.msgId
|
||||||
return !!report;
|
);
|
||||||
}, 1, 300);
|
return !!report;
|
||||||
msg.id = MessageUnique.createUniqueMsgId(
|
}, 1, 10 * 60 * 1000);
|
||||||
{
|
// 10分钟 超时
|
||||||
chatType: msg.chatType,
|
const updatemsg = updatemsgs.find((e) => e.msgId === msg.msgId);
|
||||||
peerUid: msg.peerUid,
|
if (updatemsg?.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS || updatemsg?.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS_NOSEQ) {
|
||||||
guildId: '',
|
updatemsg.id = MessageUnique.createUniqueMsgId(
|
||||||
},
|
{
|
||||||
msg.msgId
|
chatType: updatemsg.chatType,
|
||||||
);
|
peerUid: updatemsg.peerUid,
|
||||||
//此时上报的seq不是对的 不过对onebot业务无影响
|
guildId: '',
|
||||||
this.emitMsg(msg);
|
},
|
||||||
|
updatemsg.msgId
|
||||||
|
);
|
||||||
|
this.emitMsg(updatemsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.context.logger.logError('处理发送消息失败', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
msgListener.onMsgRecall = async (chatType: ChatType, uid: string, msgSeq: string) => {
|
msgListener.onMsgRecall = async (chatType: ChatType, uid: string, msgSeq: string) => {
|
||||||
|
Reference in New Issue
Block a user