From 183eab2cf45dfde2273f5ed2c2862f2dd2c1e859 Mon Sep 17 00:00:00 2001
From: idranme <idranme@outlook.com>
Date: Wed, 28 Aug 2024 17:13:26 +0800
Subject: [PATCH] optimize

---
 src/main/log.ts            | 7 ++-----
 src/ntqqapi/ntcall.ts      | 4 ++--
 src/onebot11/connect/ws.ts | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/main/log.ts b/src/main/log.ts
index dca8b32..d1b4c0c 100644
--- a/src/main/log.ts
+++ b/src/main/log.ts
@@ -18,18 +18,15 @@ export default class Log {
       return
     }
     const file = path.join(LOG_DIR, cfg.filename)
-    const refreshNick = ctx.debounce(() => {
+    /*const refreshNick = ctx.debounce(() => {
       const ntUserApi = ctx.get('ntUserApi')
       if (ntUserApi && !selfInfo.nick) {
         ntUserApi.getSelfNick(true)
       }
-    }, 1000)
+    }, 1000)*/
     const target: Logger.Target = {
       colors: 0,
       record: (record: Logger.Record) => {
-        if (!selfInfo.nick) {
-          refreshNick()
-        }
         const dateTime = new Date(record.timestamp).toLocaleString()
         const userInfo = selfInfo.uin ? `${selfInfo.nick}(${selfInfo.uin})` : ''
         const content = `${dateTime} [${record.type}] ${userInfo} | ${record.name} ${record.content}\n\n`
diff --git a/src/ntqqapi/ntcall.ts b/src/ntqqapi/ntcall.ts
index 1fcfb60..2ca3bdd 100644
--- a/src/ntqqapi/ntcall.ts
+++ b/src/ntqqapi/ntcall.ts
@@ -153,8 +153,8 @@ export function invoke<ReturnType>(params: InvokeParams<ReturnType>) {
           afterFirstCmd && secondCallback()
         }
         else {
-          log('ntqq api call failed', result)
-          reject(`ntqq api call failed, ${result.errMsg}`)
+          log('ntqq api call failed,', params.methodName, result)
+          reject(`ntqq api call failed, ${params.methodName}, ${result.errMsg}`)
         }
       }
     }
diff --git a/src/onebot11/connect/ws.ts b/src/onebot11/connect/ws.ts
index 9a9a83f..524d724 100644
--- a/src/onebot11/connect/ws.ts
+++ b/src/onebot11/connect/ws.ts
@@ -261,7 +261,7 @@ class OB11WebSocketReverse {
 
     this.wsClient.on('close', () => {
       disposeHeartBeat()
-      this.ctx.logger.info('The websocket connection: ' + this.config.url + ' closed, trying reconnecting...')
+      this.ctx.logger.info(`The websocket connection: ${this.config.url} closed${this.running ? ', trying reconnecting...' : ''}`)
       if (this.running) {
         this.ctx.setTimeout(() => this.tryConnect(), 3000)
       }