From 60c8763b9d343f887554f07cb200eda5f795c343 Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Mon, 10 Apr 2023 01:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build:=20=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=8C=96=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index c01ddb0..b49faed 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -21,11 +21,11 @@ import { ChatGPTBrowserClient } from "@waylaidwanderer/chatgpt-api"; import { av2BV } from "../utils/bilibili-bv-av-convert.js"; import querystring from "querystring"; -// 构造关键字,防止超出预期的问题 -const existsTransKey = Object.keys(transMap).join("|"); -const existsPromptKey = Object.keys(PROMPT_MAP).join("|").slice(0, -1); - export class tools extends plugin { + // 构造关键字,防止超出预期的问题 + static existsTransKey = Object.keys(transMap).join("|"); + static existsPromptKey = Object.keys(PROMPT_MAP).join("|").slice(0, -1); + constructor() { super({ name: "R插件工具和学习类", @@ -34,11 +34,11 @@ export class tools extends plugin { priority: 500, rule: [ { - reg: `^(翻|trans)[${existsTransKey}]`, + reg: `^(翻|trans)[${tools.existsTransKey}]`, fnc: "trans", }, { - reg: `^#(ocr|OCR)(${existsPromptKey})?$`, + reg: `^#(ocr|OCR)(${tools.existsPromptKey})?$`, fnc: "ocr2anything", }, {