mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 在 BotProfileManager 中添加自我介绍文件不存在的日志记录,优化文件读取逻辑
This commit is contained in:
parent
4ba2b7d52e
commit
d9b0fb6d55
@ -14,6 +14,7 @@ from zhenxun.configs.path_config import DATA_PATH, TEMPLATE_PATH
|
|||||||
from zhenxun.configs.utils.models import PluginExtraData
|
from zhenxun.configs.utils.models import PluginExtraData
|
||||||
from zhenxun.models.statistics import Statistics
|
from zhenxun.models.statistics import Statistics
|
||||||
from zhenxun.models.user_console import UserConsole
|
from zhenxun.models.user_console import UserConsole
|
||||||
|
from zhenxun.services.log import logger
|
||||||
from zhenxun.utils._build_image import BuildImage
|
from zhenxun.utils._build_image import BuildImage
|
||||||
from zhenxun.utils.platform import PlatformUtils
|
from zhenxun.utils.platform import PlatformUtils
|
||||||
|
|
||||||
@ -89,6 +90,9 @@ class BotProfileManager:
|
|||||||
bot_file_path = PROFILE_PATH / f"{bot_id}"
|
bot_file_path = PROFILE_PATH / f"{bot_id}"
|
||||||
bot_file_path.mkdir(parents=True, exist_ok=True)
|
bot_file_path.mkdir(parents=True, exist_ok=True)
|
||||||
bot_profile_file = bot_file_path / "profile.txt"
|
bot_profile_file = bot_file_path / "profile.txt"
|
||||||
|
if not bot_profile_file.exists():
|
||||||
|
logger.debug(f"BOT自我介绍文件不存在: {bot_profile_file}, 跳过读取")
|
||||||
|
return
|
||||||
async with aiofiles.open(bot_profile_file, encoding="utf-8") as f:
|
async with aiofiles.open(bot_profile_file, encoding="utf-8") as f:
|
||||||
introduction = await f.read()
|
introduction = await f.read()
|
||||||
avatar = bot_file_path / f"{bot_id}.png"
|
avatar = bot_file_path / f"{bot_id}.png"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user