From e02bddc78f8d6cd0f16e414ca0acae0f1e23bd44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?=
 <nanaeonn@outlook.com>
Date: Sat, 10 Aug 2024 22:40:40 +0800
Subject: [PATCH] fix

---
 src/onebot/helper/msg.ts | 12 +++++-------
 src/onebot/main.ts       | 10 +++++-----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/onebot/helper/msg.ts b/src/onebot/helper/msg.ts
index 33416b3e..2fec81c8 100644
--- a/src/onebot/helper/msg.ts
+++ b/src/onebot/helper/msg.ts
@@ -21,7 +21,7 @@ import {
 import { promises as fs } from 'node:fs';
 import ffmpeg from 'fluent-ffmpeg';
 import { calculateFileMD5, isGIF } from '@/common/utils/file';
-import { defaultVideoThumb, getVideoInfo } from '@/common/utils/video';
+import { getVideoInfo } from '@/common/utils/video';
 import { encodeSilk } from '@/common/utils/audio';
 import faceConfig from '@/core/external/face_config.json';
 import * as pathLib from 'node:path';
@@ -166,7 +166,7 @@ export class SendMsgElementConstructor {
         } catch (e) {
             logger.logError('获取视频信息失败', e);
         }
-        const createThumb = new Promise<string>((resolve, reject) => {
+        const createThumb = new Promise<string | undefined>((resolve, reject) => {
             const thumbFileName = `${md5}_0.png`;
             const thumbPath = pathLib.join(thumb, thumbFileName);
             ffmpeg(filePath)
@@ -179,9 +179,7 @@ export class SendMsgElementConstructor {
                             resolve(thumbPath);
                         }).catch(reject);
                     } else {
-                        fs.writeFile(thumbPath, defaultVideoThumb).then(() => {
-                            resolve(thumbPath);
-                        }).catch(reject);
+                        resolve(undefined);
                     }
                 })
                 .screenshots({
@@ -195,10 +193,10 @@ export class SendMsgElementConstructor {
         });
         const thumbPath = new Map();
         const _thumbPath = await createThumb;
-        const thumbSize = (await fs.stat(_thumbPath)).size;
+        const thumbSize = _thumbPath ? (await fs.stat(_thumbPath)).size : 0;
         // log("生成缩略图", _thumbPath)
         thumbPath.set(0, _thumbPath);
-        const thumbMd5 = await calculateFileMD5(_thumbPath);
+        const thumbMd5 = _thumbPath ? await calculateFileMD5(_thumbPath) : "";
         const element: SendVideoElement = {
             elementType: ElementType.VIDEO,
             elementId: '',
diff --git a/src/onebot/main.ts b/src/onebot/main.ts
index 3ffdf632..1eb0d474 100644
--- a/src/onebot/main.ts
+++ b/src/onebot/main.ts
@@ -33,11 +33,11 @@ export class NapCatOneBot11Adapter {
         msgListener.onInputStatusPush = async data => {
             const uin = await this.core.ApiContext.UserApi.getUinByUidV2(data.fromUin);
             this.context.logger.log(`[Notice] [输入状态] ${uin} ${data.statusText}`);
-            this.networkManager.emitEvent(new OB11InputStatusEvent(
-                parseInt(uin),
-                data.eventType,
-                data.statusText
-            ));
+            // this.networkManager.emitEvent(new OB11InputStatusEvent(
+            //     parseInt(uin),
+            //     data.eventType,
+            //     data.statusText
+            // ));
         };
     }
 }