mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-09-28 04:05:12 +00:00
fix: #339
This commit is contained in:
parent
e80a1cc64a
commit
b83c41ad56
@ -4,7 +4,7 @@
|
||||
"name": "NapCatQQ",
|
||||
"slug": "NapCat.Framework",
|
||||
"description": "高性能的 OneBot 11 协议实现",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.2",
|
||||
"icon": "./logo.png",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "napcat",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"scripts": {
|
||||
"build:framework": "vite build --mode framework",
|
||||
"build:shell": "vite build --mode shell",
|
||||
|
@ -1 +1 @@
|
||||
export const napCatVersion = '2.3.0';
|
||||
export const napCatVersion = '2.3.2';
|
||||
|
@ -298,65 +298,6 @@ export class NTQQFileApi {
|
||||
});
|
||||
}
|
||||
|
||||
async addFileCache(peer: Peer, msgId: string, msgSeq: string, senderUid: string, elemId: string, elemType: string, fileSize: string, fileName: string) {
|
||||
let GroupData;
|
||||
let BuddyData;
|
||||
if (peer.chatType === ChatType.KCHATTYPEGROUP) {
|
||||
GroupData =
|
||||
[{
|
||||
groupCode: peer.peerUid,
|
||||
isConf: false,
|
||||
hasModifyConfGroupFace: true,
|
||||
hasModifyConfGroupName: true,
|
||||
groupName: 'NapCat.Cached',
|
||||
remark: 'NapCat.Cached',
|
||||
}];
|
||||
} else if (peer.chatType === ChatType.KCHATTYPEC2C) {
|
||||
BuddyData = [{
|
||||
category_name: 'NapCat.Cached',
|
||||
peerUid: peer.peerUid,
|
||||
peerUin: peer.peerUid,
|
||||
remark: 'NapCat.Cached',
|
||||
}];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.context.session.getSearchService().addSearchHistory({
|
||||
type: 4,
|
||||
contactList: [],
|
||||
id: -1,
|
||||
groupInfos: [],
|
||||
msgs: [],
|
||||
fileInfos: [
|
||||
{
|
||||
chatType: peer.chatType,
|
||||
buddyChatInfo: BuddyData || [],
|
||||
discussChatInfo: [],
|
||||
groupChatInfo: GroupData || [],
|
||||
dataLineChatInfo: [],
|
||||
tmpChatInfo: [],
|
||||
msgId: msgId,
|
||||
msgSeq: msgSeq,
|
||||
msgTime: Math.floor(Date.now() / 1000).toString(),
|
||||
senderUid: senderUid,
|
||||
senderNick: 'NapCat.Cached',
|
||||
senderRemark: 'NapCat.Cached',
|
||||
senderCard: 'NapCat.Cached',
|
||||
elemId: elemId,
|
||||
elemType: elemType,
|
||||
fileSize: fileSize,
|
||||
filePath: '',
|
||||
fileName: fileName,
|
||||
hits: [{
|
||||
start: 12,
|
||||
end: 14,
|
||||
}],
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
async searchForFile(keys: string[]): Promise<SearchResultItem | undefined> {
|
||||
const randomResultId = 100000 + Math.floor(Math.random() * 10000);
|
||||
let searchId = 0;
|
||||
|
@ -115,6 +115,7 @@ export class OneBotMsgApi {
|
||||
file_id: encodedFileId,
|
||||
url: await this.core.apis.FileApi.getImageUrl(element),
|
||||
file_size: element.fileSize,
|
||||
file_unique: element.fileName
|
||||
},
|
||||
};
|
||||
} catch (e: any) {
|
||||
@ -129,20 +130,6 @@ export class OneBotMsgApi {
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
};
|
||||
await this.core.apis.FileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
elementWrapper.elementId,
|
||||
elementWrapper.elementType.toString(),
|
||||
element.fileSize,
|
||||
element.fileName,
|
||||
);
|
||||
return {
|
||||
type: OB11MessageDataType.file,
|
||||
data: {
|
||||
@ -151,6 +138,7 @@ export class OneBotMsgApi {
|
||||
url: element.filePath,
|
||||
file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId),
|
||||
file_size: element.fileSize,
|
||||
file_unique: element.fileName,
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -182,20 +170,6 @@ export class OneBotMsgApi {
|
||||
},
|
||||
|
||||
marketFaceElement: async (_, msg, elementWrapper) => {
|
||||
await this.core.apis.FileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
elementWrapper.elementId,
|
||||
elementWrapper.elementType.toString(),
|
||||
'0',
|
||||
'marketface',
|
||||
);
|
||||
const peer = {
|
||||
chatType: msg.chatType,
|
||||
peerUid: msg.peerUid,
|
||||
@ -208,6 +182,7 @@ export class OneBotMsgApi {
|
||||
file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId),
|
||||
path: elementWrapper.elementId,
|
||||
url: elementWrapper.elementId,
|
||||
file_unique: _.key
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -283,21 +258,6 @@ export class OneBotMsgApi {
|
||||
videoDownUrl = element.filePath;
|
||||
}
|
||||
|
||||
await this.core.apis.FileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
elementWrapper.elementId,
|
||||
elementWrapper.elementType.toString(),
|
||||
element.fileSize ?? '0',
|
||||
element.fileName,
|
||||
);
|
||||
|
||||
return {
|
||||
type: OB11MessageDataType.video,
|
||||
data: {
|
||||
@ -306,6 +266,7 @@ export class OneBotMsgApi {
|
||||
url: videoDownUrl,
|
||||
file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId),
|
||||
file_size: element.fileSize,
|
||||
file_unique: element.fileName,
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -316,20 +277,6 @@ export class OneBotMsgApi {
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
};
|
||||
await this.core.apis.FileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
elementWrapper.elementId,
|
||||
elementWrapper.elementType.toString(),
|
||||
element.fileSize || '0',
|
||||
element.fileUuid || '',
|
||||
);
|
||||
return {
|
||||
type: OB11MessageDataType.voice,
|
||||
data: {
|
||||
|
@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
undefined,
|
||||
SettingButton('V2.3.0', 'napcat-update-button', 'secondary'),
|
||||
SettingButton('V2.3.2', 'napcat-update-button', 'secondary'),
|
||||
),
|
||||
]),
|
||||
SettingList([
|
||||
|
@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
void 0,
|
||||
SettingButton("V2.3.0", "napcat-update-button", "secondary")
|
||||
SettingButton("V2.3.2", "napcat-update-button", "secondary")
|
||||
)
|
||||
]),
|
||||
SettingList([
|
||||
|
Loading…
Reference in New Issue
Block a user