mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2026-01-29 09:17:27 +00:00
🐛 fix(plugin): resolve issue causing incorrect message formatting in bot responses
This commit is contained in:
parent
27609a7c80
commit
a57c9b2c55
@ -141,7 +141,7 @@ class UserConfigManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除用户配置缓存
|
* 清除用户配置缓存
|
||||||
* @param {string} userId - 用户QQ号,如果不传则清除所有缓存
|
* @param {string|null} userId - 用户QQ号,如果不传则清除所有缓存
|
||||||
*/
|
*/
|
||||||
clearCache(userId) {
|
clearCache(userId) {
|
||||||
if (userId) {
|
if (userId) {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ async function init() {
|
|||||||
await fsp.copyFile(pluginDefaultFile, configFile);
|
await fsp.copyFile(pluginDefaultFile, configFile);
|
||||||
logger.mark(`[crystelf-plugin] 默认配置复制成功: ${configFile}`);
|
logger.mark(`[crystelf-plugin] 默认配置复制成功: ${configFile}`);
|
||||||
} catch (copyError) {
|
} catch (copyError) {
|
||||||
logger.warn(`[crystelf-plugin] 复制默认配置失败,创建空配置: ${copyError.message}`);
|
logger.warn(`[crystelf-plugin] 复制默认配置失败,创建空配置: ${copyError}`);
|
||||||
await fc.writeJSON(configFile, {});
|
await fc.writeJSON(configFile, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ async function init() {
|
|||||||
try {
|
try {
|
||||||
pluginFiles = (await fsp.readdir(pluginConfigPath)).filter((f) => f.endsWith('.json'));
|
pluginFiles = (await fsp.readdir(pluginConfigPath)).filter((f) => f.endsWith('.json'));
|
||||||
} catch (error) {
|
} 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);
|
await fsp.copyFile(pluginFilePath, dataFilePath);
|
||||||
logger.mark(`[crystelf-plugin] 配置文件缺失,已复制: ${file}`);
|
logger.mark(`[crystelf-plugin] 配置文件缺失,已复制: ${file}`);
|
||||||
} catch (copyError) {
|
} 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);
|
await fc.writeJSON(filePath, data);
|
||||||
} catch (mergeError) {
|
} catch (mergeError) {
|
||||||
logger.error('[crystelf-plugin]合并配置失败..');
|
logger.error('[crystelf-plugin]合并配置失败..');
|
||||||
|
logger.error(mergeError);
|
||||||
// 忽略合并错误,使用现有数据
|
// 忽略合并错误,使用现有数据
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ const configControl = {
|
|||||||
await fc.writeJSON(filePath, value);
|
await fc.writeJSON(filePath, value);
|
||||||
logger.mark(`[crystelf-plugin] 创建新配置文件: ${filePath}`);
|
logger.mark(`[crystelf-plugin] 创建新配置文件: ${filePath}`);
|
||||||
} catch (writeError) {
|
} catch (writeError) {
|
||||||
logger.error(`[crystelf-plugin] 创建配置文件失败: ${writeError.message}`);
|
logger.error(`[crystelf-plugin] 创建配置文件失败: ${writeError}`);
|
||||||
throw writeError;
|
throw writeError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,7 +200,7 @@ const configControl = {
|
|||||||
// 写入配置文件
|
// 写入配置文件
|
||||||
await fc.writeJSON(filePath, value);
|
await fc.writeJSON(filePath, value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`[crystelf-plugin] 设置配置失败 ${key}: ${error.message}`);
|
logger.error(`[crystelf-plugin] 设置配置失败 ${key}: ${error}`);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,7 +217,7 @@ const configControl = {
|
|||||||
// 直接写入配置文件
|
// 直接写入配置文件
|
||||||
await fc.writeJSON(filePath, value);
|
await fc.writeJSON(filePath, value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`[crystelf-plugin] 保存配置文件失败 ${filePath}: ${error.message}`);
|
logger.error(`[crystelf-plugin] 保存配置文件失败 ${filePath}: ${error}`);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
resources/img/logo.png
Normal file
BIN
resources/img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Loading…
x
Reference in New Issue
Block a user