mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
feat✨: 添加单个插件帮助图片
This commit is contained in:
@@ -2,7 +2,7 @@ import nonebot
|
||||
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
from zhenxun.models.plugin_info import PluginInfo
|
||||
from zhenxun.utils.image_utils import BuildImage
|
||||
from zhenxun.utils.image_utils import BuildImage, ImageTemplate
|
||||
|
||||
from ._utils import HelpImageBuild
|
||||
|
||||
@@ -11,7 +11,7 @@ random_bk_path = IMAGE_PATH / "background" / "help" / "simple_help"
|
||||
background = IMAGE_PATH / "background" / "0.png"
|
||||
|
||||
|
||||
async def create_help_img(group_id: int | None):
|
||||
async def create_help_img(group_id: str | None):
|
||||
"""
|
||||
说明:
|
||||
生成帮助图片
|
||||
@@ -21,7 +21,7 @@ async def create_help_img(group_id: int | None):
|
||||
await HelpImageBuild().build_image(group_id)
|
||||
|
||||
|
||||
async def get_plugin_help(name: str) -> str:
|
||||
async def get_plugin_help(name: str) -> str | BuildImage:
|
||||
"""获取功能的帮助信息
|
||||
|
||||
参数:
|
||||
@@ -30,6 +30,10 @@ async def get_plugin_help(name: str) -> str:
|
||||
if plugin := await PluginInfo.get_or_none(name=name):
|
||||
_plugin = nonebot.get_plugin_by_module_name(plugin.module_path)
|
||||
if _plugin and _plugin.metadata:
|
||||
return _plugin.metadata.usage
|
||||
items = {
|
||||
"简介": _plugin.metadata.description,
|
||||
"用法": _plugin.metadata.usage,
|
||||
}
|
||||
return await ImageTemplate.hl_page(name, items)
|
||||
return "糟糕! 该功能没有帮助喔..."
|
||||
return "没有查找到这个功能噢..."
|
||||
|
||||
Reference in New Issue
Block a user