Files
main_plugin_farm/core/help.py
T

36 lines
1.2 KiB
Python
Raw Normal View History

2025-08-06 17:51:26 +08:00
from zhenxun.configs.path_config import DATA_PATH
from zhenxun.services.log import logger
2025-11-30 16:45:13 +08:00
from ..utils import config, getToolManager
2025-08-06 17:51:26 +08:00
2025-10-12 06:12:14 +08:00
class CHelpManager:
@classmethod
async def createHelpImage(cls) -> bool:
2025-11-30 16:45:13 +08:00
templatePath = config.g_sResourcePath / "html/help.html"
outputPath = config.g_sResourcePath / "temp_html/help.html"
2025-10-12 06:12:14 +08:00
savePath = DATA_PATH / "farm_res/html/help.png"
context = {
"main_title": "真寻农场帮助菜单",
"subtitle": "[]中为可选参数",
"page_title": "真寻农场帮助菜单",
"font_family": "MyFont",
"contents": [
{"title": "主要指令", "commands": ["指令A", "指令B"]},
{"title": "B", "commands": ["指令D", "指令E", "指令M", "指令i"]},
],
}
try:
2025-11-30 16:45:13 +08:00
getToolManager().renderHtmlToFile(templatePath, context, outputPath)
2025-10-12 06:12:14 +08:00
2025-11-30 16:45:13 +08:00
bytes = await getToolManager().screenshotSave(
str(outputPath), str(savePath), 1500, 2300
)
2025-10-12 06:12:14 +08:00
except Exception as e:
logger.warning("绘制农场帮助菜单失败", e=e)
return False
return True