From 8bd23798ad23093057b3a9c5b4f626b26de40408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=8C?= Date: Wed, 19 Jul 2023 09:34:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugins/stdin.js | 12 +++++------- package.json | 2 +- plugins/adapter/go-cqhttp.js | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/plugins/stdin.js b/lib/plugins/stdin.js index 8ce2e88..85d7498 100644 --- a/lib/plugins/stdin.js +++ b/lib/plugins/stdin.js @@ -7,6 +7,9 @@ Bot.adapter.push(new class stdinAdapter { constructor() { this.id = "stdin" this.name = "标准输入" + this.path = "data/stdin/" + if (!fs.existsSync(this.path)) + fs.mkdirSync(this.path) } async makeBuffer(file) { @@ -25,7 +28,7 @@ Bot.adapter.push(new class stdinAdapter { file.url = data.replace(/^base64:\/\/.*/, "base64://...") file.buffer = await this.makeBuffer(data) file.type = await fileTypeFromBuffer(file.buffer) - file.path = `${Bot[this.id].data_dir}${Date.now()}.${file.type.ext}` + file.path = `${this.path}${Date.now()}.${file.type.ext}` } catch (err) { logger.error(`文件类型检测错误:${logger.red(err)}`) } @@ -91,7 +94,7 @@ Bot.adapter.push(new class stdinAdapter { return false } - const files = `${Bot[this.id].data_dir}${Date.now()}-${name}` + const files = `${this.path}${Date.now()}-${name}` logger.info(`${logger.blue(`[${this.id}]`)} 发送文件:${file}\n文件已保存到:${logger.cyan(files)}`) return fs.writeFileSync(files, buffer) } @@ -143,13 +146,8 @@ Bot.adapter.push(new class stdinAdapter { group_id: this.id, group_name: this.name, }), - - data_dir: `${process.cwd()}/data/stdin/`, } - if (!fs.existsSync(Bot[this.id].data_dir)) - fs.mkdirSync(Bot[this.id].data_dir) - if (!Bot.uin.includes(this.id)) Bot.uin.push(this.id) diff --git a/package.json b/package.json index 0319386..3bd66a5 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "node-xlsx": "^0.23.0", "oicq": "link:lib/modules/oicq", "pm2": "^5.3.0", - "puppeteer": "^20.8.2", + "puppeteer": "^20.8.3", "redis": "^4.6.7", "sequelize": "^6.32.1", "sqlite3": "^5.1.6", diff --git a/plugins/adapter/go-cqhttp.js b/plugins/adapter/go-cqhttp.js index 99a01a6..ca9c3d4 100644 --- a/plugins/adapter/go-cqhttp.js +++ b/plugins/adapter/go-cqhttp.js @@ -589,7 +589,7 @@ Bot.adapter.push(new class gocqhttpAdapter { makeMessage(data) { const message = [] for (const i of data.message) - message.push({ type: i.type, ...i.data }) + message.push({ ...i.data, type: i.type }) data.message = message switch (data.message_type) {