mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: Add getFileCacheInfo
to NTQQApi
This commit is contained in:
parent
11108bc13f
commit
91075e192b
@ -17,8 +17,8 @@ import {
|
|||||||
SendMessageElement,
|
SendMessageElement,
|
||||||
User,
|
User,
|
||||||
CacheScanResult,
|
CacheScanResult,
|
||||||
ChatCacheList,
|
ChatCacheList, ChatCacheListItemBasic,
|
||||||
ChatCacheListItemBasic
|
CacheFileList, CacheFileListItem, CacheFileType,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {addHistoryMsg, friendRequests, groupNotifies, msgHistory, selfInfo} from "../common/data";
|
import {addHistoryMsg, friendRequests, groupNotifies, msgHistory, selfInfo} from "../common/data";
|
||||||
@ -87,6 +87,7 @@ export enum NTQQApiMethod {
|
|||||||
CACHE_CLEAR = 'nodeIKernelStorageCleanService/clearCacheDataByKeys',
|
CACHE_CLEAR = 'nodeIKernelStorageCleanService/clearCacheDataByKeys',
|
||||||
|
|
||||||
CACHE_CHAT_GET = 'nodeIKernelStorageCleanService/getChatCacheInfo',
|
CACHE_CHAT_GET = 'nodeIKernelStorageCleanService/getChatCacheInfo',
|
||||||
|
CACHE_FILE_GET = 'nodeIKernelStorageCleanService/getFileCacheInfo',
|
||||||
CACHE_CHAT_CLEAR = 'nodeIKernelStorageCleanService/clearChatCacheInfo',
|
CACHE_CHAT_CLEAR = 'nodeIKernelStorageCleanService/clearChatCacheInfo',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +767,7 @@ export class NTQQApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getChatCacheList(type: ChatType, pageSize: number = 80, pageIndex: number = 0) {
|
static getChatCacheList(type: ChatType, pageSize: number = 1000, pageIndex: number = 0) {
|
||||||
return new Promise<ChatCacheList>((res, rej) => {
|
return new Promise<ChatCacheList>((res, rej) => {
|
||||||
callNTQQApi<ChatCacheList>({
|
callNTQQApi<ChatCacheList>({
|
||||||
methodName: NTQQApiMethod.CACHE_CHAT_GET,
|
methodName: NTQQApiMethod.CACHE_CHAT_GET,
|
||||||
@ -781,6 +782,21 @@ export class NTQQApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getFileCacheInfo(fileType: CacheFileType, pageSize: number = 1000, lastRecord?: CacheFileListItem) {
|
||||||
|
const _lastRecord = lastRecord ? lastRecord : { fileType: fileType };
|
||||||
|
|
||||||
|
return callNTQQApi<CacheFileList>({
|
||||||
|
methodName: NTQQApiMethod.CACHE_FILE_GET,
|
||||||
|
args: [{
|
||||||
|
fileType: fileType,
|
||||||
|
restart: true,
|
||||||
|
pageSize: pageSize,
|
||||||
|
order: 1,
|
||||||
|
lastRecord: _lastRecord,
|
||||||
|
}, null]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
static async clearChatCache(chats: ChatCacheListItemBasic[] = [], fileKeys: unknown[] = []) {
|
static async clearChatCache(chats: ChatCacheListItemBasic[] = [], fileKeys: unknown[] = []) {
|
||||||
return await callNTQQApi<GeneralCallResult>({
|
return await callNTQQApi<GeneralCallResult>({
|
||||||
methodName: NTQQApiMethod.CACHE_CHAT_CLEAR,
|
methodName: NTQQApiMethod.CACHE_CHAT_CLEAR,
|
||||||
|
@ -392,3 +392,30 @@ export interface ChatCacheListItemBasic {
|
|||||||
chatType?: ChatType,
|
chatType?: ChatType,
|
||||||
isChecked?: boolean
|
isChecked?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum CacheFileType {
|
||||||
|
IMAGE = 0,
|
||||||
|
VIDEO = 1,
|
||||||
|
AUDIO = 2,
|
||||||
|
DOCUMENT = 3,
|
||||||
|
OTHER = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheFileList {
|
||||||
|
infos: CacheFileListItem[],
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheFileListItem {
|
||||||
|
fileSize: string,
|
||||||
|
fileTime: string,
|
||||||
|
fileKey: string,
|
||||||
|
elementId: string,
|
||||||
|
elementIdStr: string,
|
||||||
|
fileType: CacheFileType,
|
||||||
|
path: string,
|
||||||
|
fileName: string,
|
||||||
|
senderId: string,
|
||||||
|
previewPath: string,
|
||||||
|
senderName: string,
|
||||||
|
isChecked?: boolean,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user