From ce653cab38e5f5c8eb9d4321471d1fb0cf6005ff Mon Sep 17 00:00:00 2001 From: TBXark Date: Fri, 20 Oct 2023 14:17:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F`SYS?= =?UTF-8?q?TEM=5FINIT=5FMESSAGE`=E8=A2=AB=E8=A6=86=E7=9B=96BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 13 +++++++++---- dist/timestamp | 2 +- src/env.js | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index ced02c03..2199f7c5 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "3713d4d", "timestamp": 1697520630} +{"sha": "7c21224", "timestamp": 1697782599} diff --git a/dist/index.js b/dist/index.js index 67d7f611..59c4ee98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -41,9 +41,9 @@ var ENV = { // 检查更新的分支 UPDATE_BRANCH: "master", // 当前版本 - BUILD_TIMESTAMP: 1697520630, + BUILD_TIMESTAMP: 1697782599, // 当前版本 commit id - BUILD_VERSION: "3713d4d", + BUILD_VERSION: "7c21224", I18N: null, LANGUAGE: "zh-cn", // 使用流模式 @@ -83,6 +83,7 @@ function initEnv(env, i18n2) { DATABASE = env.DATABASE; API_GUARD = env.API_GUARD; AI = env.AI; + ENV.SYSTEM_INIT_MESSAGE = ENV.I18N.env.system_init_message; for (const key of Object.keys(ENV)) { const t = ENV_VALUE_TYPE[key] ? ENV_VALUE_TYPE[key] : typeof ENV[key]; if (env[key]) { @@ -128,7 +129,6 @@ function initEnv(env, i18n2) { } } ENV.I18N = i18n2((ENV.LANGUAGE || "cn").toLowerCase()); - ENV.SYSTEM_INIT_MESSAGE = ENV.I18N.env.system_init_message; console.log(ENV); } @@ -2170,7 +2170,12 @@ async function msgHandleGroupMessage(message, context) { if (!message.text) { return new Response("Non text message", { status: 200 }); } - const botName = context.SHARE_CONTEXT.currentBotName; + let botName = context.SHARE_CONTEXT.currentBotName; + if (!botName) { + const res = await getBot(context.SHARE_CONTEXT.currentBotToken); + context.SHARE_CONTEXT.currentBotName = res.info.name; + botName = res.info.name; + } if (botName) { let mentioned = false; if (message.reply_to_message) { diff --git a/dist/timestamp b/dist/timestamp index a2e8d554..d5a5f6dd 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1697520630 +1697782599 diff --git a/src/env.js b/src/env.js index c29e8211..77bd72b8 100644 --- a/src/env.js +++ b/src/env.js @@ -157,6 +157,7 @@ export function initEnv(env, i18n) { API_GUARD = env.API_GUARD; AI = env.AI; + ENV.SYSTEM_INIT_MESSAGE = ENV.I18N.env.system_init_message; for (const key of Object.keys(ENV)) { const t = ENV_VALUE_TYPE[key]?ENV_VALUE_TYPE[key]:(typeof ENV[key]); if (env[key]) { @@ -205,6 +206,5 @@ export function initEnv(env, i18n) { } } ENV.I18N = i18n((ENV.LANGUAGE || 'cn').toLowerCase()); - ENV.SYSTEM_INIT_MESSAGE = ENV.I18N.env.system_init_message; console.log(ENV); }