🐛 fix(plugin): resolve issue causing incorrect message formatting in bot responses

This commit is contained in:
Jerry 2026-01-07 18:33:40 +08:00
parent 27609a7c80
commit a57c9b2c55
3 changed files with 23 additions and 22 deletions

View File

@ -141,7 +141,7 @@ class UserConfigManager {
/**
* 清除用户配置缓存
* @param {string} userId - 用户QQ号如果不传则清除所有缓存
* @param {string|null} userId - 用户QQ号如果不传则清除所有缓存
*/
clearCache(userId) {
if (userId) {

View File

@ -39,7 +39,7 @@ async function init() {
await fsp.copyFile(pluginDefaultFile, configFile);
logger.mark(`[crystelf-plugin] 默认配置复制成功: ${configFile}`);
} catch (copyError) {
logger.warn(`[crystelf-plugin] 复制默认配置失败,创建空配置: ${copyError.message}`);
logger.warn(`[crystelf-plugin] 复制默认配置失败,创建空配置: ${copyError}`);
await fc.writeJSON(configFile, {});
}
}
@ -47,7 +47,7 @@ async function init() {
try {
pluginFiles = (await fsp.readdir(pluginConfigPath)).filter((f) => f.endsWith('.json'));
} catch (error) {
logger.warn(`[crystelf-plugin] 读取默认配置目录失败: ${error.message}`);
logger.warn(`[crystelf-plugin] 读取默认配置目录失败: ${error}`);
}
// 复制缺失的配置文件
@ -61,7 +61,7 @@ async function init() {
await fsp.copyFile(pluginFilePath, dataFilePath);
logger.mark(`[crystelf-plugin] 配置文件缺失,已复制: ${file}`);
} catch (copyError) {
logger.warn(`[crystelf-plugin] 复制配置文件失败 ${file}: ${copyError.message}`);
logger.warn(`[crystelf-plugin] 复制配置文件失败 ${file}: ${copyError}`);
}
}
}
@ -99,6 +99,7 @@ async function init() {
await fc.writeJSON(filePath, data);
} catch (mergeError) {
logger.error('[crystelf-plugin]合并配置失败..');
logger.error(mergeError);
// 忽略合并错误,使用现有数据
}
@ -176,7 +177,7 @@ const configControl = {
await fc.writeJSON(filePath, value);
logger.mark(`[crystelf-plugin] 创建新配置文件: ${filePath}`);
} catch (writeError) {
logger.error(`[crystelf-plugin] 创建配置文件失败: ${writeError.message}`);
logger.error(`[crystelf-plugin] 创建配置文件失败: ${writeError}`);
throw writeError;
}
}
@ -199,7 +200,7 @@ const configControl = {
// 写入配置文件
await fc.writeJSON(filePath, value);
} catch (error) {
logger.error(`[crystelf-plugin] 设置配置失败 ${key}: ${error.message}`);
logger.error(`[crystelf-plugin] 设置配置失败 ${key}: ${error}`);
throw error;
}
}
@ -216,7 +217,7 @@ const configControl = {
// 直接写入配置文件
await fc.writeJSON(filePath, value);
} catch (error) {
logger.error(`[crystelf-plugin] 保存配置文件失败 ${filePath}: ${error.message}`);
logger.error(`[crystelf-plugin] 保存配置文件失败 ${filePath}: ${error}`);
throw error;
}
}

BIN
resources/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB