fix: Fix type

This commit is contained in:
Misa Liu 2024-02-27 23:27:00 +08:00
parent 3ec1134204
commit 11108bc13f
No known key found for this signature in database
GPG Key ID: F70B23D0A4FED791
3 changed files with 7 additions and 7 deletions

View File

@ -766,7 +766,7 @@ export class NTQQApi {
});
}
static getChatCacheList(type: 1 | 2, pageSize: number = 80, pageIndex: number = 0) {
static getChatCacheList(type: ChatType, pageSize: number = 80, pageIndex: number = 0) {
return new Promise<ChatCacheList>((res, rej) => {
callNTQQApi<ChatCacheList>({
methodName: NTQQApiMethod.CACHE_CHAT_GET,

View File

@ -377,7 +377,7 @@ export interface ChatCacheList {
}
export interface ChatCacheListItem {
chatType: 1 | 2,
chatType: ChatType,
basicChatCacheInfo: ChatCacheListItemBasic,
guildChatCacheInfo: unknown[] // TODO: 没用过频道所以不知道这里边的详细内容
}
@ -389,6 +389,6 @@ export interface ChatCacheListItemBasic {
uin: string,
remarkName: string,
nickName: string,
chatType?: 1 | 2,
chatType?: ChatType,
isChecked?: boolean
}

View File

@ -40,8 +40,8 @@ export default class CleanCache extends BaseAction<void, void> {
// 清理聊天记录
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
// await clearChatCache(ChatCacheType.PRIVATE); // 私聊消息
// await clearChatCache(ChatCacheType.GROUP); // 群聊消息
// await clearChatCache(ChatType.PRIVATE); // 私聊消息
// await clearChatCache(ChatType.GROUP); // 群聊消息
@ -72,12 +72,12 @@ function deleteCachePath(pathList: string[]) {
}
}
async function clearChatCache(type: ChatCacheType) {
async function clearChatCache(type: ChatType) {
const cacheList = await getCacheList(type);
return NTQQApi.clearChatCache(cacheList, []);
}
function getCacheList(type: ChatCacheType) { // NOTE: 做这个方法主要是因为目前还不支持针对频道消息的清理
function getCacheList(type: ChatType) { // NOTE: 做这个方法主要是因为目前还不支持针对频道消息的清理
return new Promise<Array<ChatCacheListItemBasic>>((res, rej) => {
NTQQApi.getChatCacheList(type, 1000, 0)
.then(data => {