From 11108bc13f5c4c0c8f1a2f9ca664345504d17f03 Mon Sep 17 00:00:00 2001
From: Misa Liu <misaliu@misaliu.top>
Date: Tue, 27 Feb 2024 23:27:00 +0800
Subject: [PATCH] fix: Fix type

---
 src/ntqqapi/ntcall.ts             | 2 +-
 src/ntqqapi/types.ts              | 4 ++--
 src/onebot11/action/CleanCache.ts | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/ntqqapi/ntcall.ts b/src/ntqqapi/ntcall.ts
index 2b48e22..81974d5 100644
--- a/src/ntqqapi/ntcall.ts
+++ b/src/ntqqapi/ntcall.ts
@@ -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,
diff --git a/src/ntqqapi/types.ts b/src/ntqqapi/types.ts
index 01e0a19..4b79e3d 100644
--- a/src/ntqqapi/types.ts
+++ b/src/ntqqapi/types.ts
@@ -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
 }
diff --git a/src/onebot11/action/CleanCache.ts b/src/onebot11/action/CleanCache.ts
index f2e3abd..3012d65 100644
--- a/src/onebot11/action/CleanCache.ts
+++ b/src/onebot11/action/CleanCache.ts
@@ -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 => {