diff --git a/StarRailUID/starrailuid_help/Help.json b/StarRailUID/starrailuid_help/Help.json index d926d60..7e5e1b1 100644 --- a/StarRailUID/starrailuid_help/Help.json +++ b/StarRailUID/starrailuid_help/Help.json @@ -3,25 +3,25 @@ "desc": "需要先绑定uid", "data": [ { - "name": "sr绑定uid", + "name": "绑定uid", "desc": "绑定你的星铁UID", - "eg": "sr绑定uid123456", + "eg": "绑定uid123456", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr删除uid", + "name": "删除uid", "desc": "删除你的星铁UID", - "eg": "sr删除uid123456", + "eg": "删除uid123456", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr切换uid", + "name": "切换uid", "desc": "切换你的星铁UID", - "eg": "sr切换uid123456", + "eg": "切换uid123456", "need_ck": false, "need_sk": false, "need_admin": false @@ -32,73 +32,81 @@ "desc": "查询一些基本信息", "data": [ { - "name": "sruid", + "name": "查询", "desc": "角色信息一览,后可跟UID", - "eg": "sruid100740568", + "eg": "uid100740568", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr深渊", + "name": "深渊", "desc": "查询星铁深渊信息", - "eg": "sr深渊100740568", + "eg": "深渊100740568", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "srmr", + "name": "mr", "desc": "查询自己的体力派遣", - "eg": "sr每日", + "eg": "每日", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr札记", + "name": "札记", "desc": "查询自己的每月收入", - "eg": "srzj", + "eg": "zj", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr签到", + "name": "签到", "desc": "米游社签到", - "eg": "sr签到", + "eg": "签到", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr抽卡记录", + "name": "抽卡记录", "desc": "查询自己的抽卡记录", - "eg": "sr抽卡记录", + "eg": "抽卡记录", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr每月统计", - "desc": "srzj的文字版", - "eg": "sr每月统计", + "name": "每月统计", + "desc": "zj的文字版", + "eg": "每月统计", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr当前状态", - "desc": "srmr的文字版", - "eg": "sr当前状态", + "name": "当前状态", + "desc": "mr的文字版", + "eg": "当前状态", "need_ck": true, "need_sk": false, "need_admin": false }, { - "name": "sr查询模拟宇宙", + "name": "查询模拟宇宙", "desc": "查询模拟宇宙的信息", - "eg": "sr查询宇宙", + "eg": "查询宇宙", + "need_ck": true, + "need_sk": false, + "need_admin": false + }, + { + "name": "查询寰宇蝗灾", + "desc": "查询寰宇蝗灾的信息", + "eg": "查询寰宇蝗灾", "need_ck": true, "need_sk": false, "need_admin": false @@ -109,17 +117,17 @@ "desc": "数据源由Mihomo提供", "data": [ { - "name": "sr强制刷新", + "name": "强制刷新", "desc": "刷新自己游戏内面板数据", - "eg": "sr强制刷新", + "eg": "强制刷新", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr查询xx", + "name": "查询[角色]", "desc": "查询游戏内面板数据", - "eg": "sr查询希儿", + "eg": "查询希儿", "need_ck": false, "need_sk": false, "need_admin": false @@ -130,33 +138,33 @@ "desc": "提供 WIKI 查询", "data": [ { - "name": "sr角色攻略", + "name": "角色攻略", "desc": "获取角色攻略", - "eg": "sr角色攻略 希儿", + "eg": "角色攻略 希儿", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr遗器", + "name": "遗器", "desc": "获取遗器图鉴", - "eg": "sr遗器 星体差分机", + "eg": "遗器 星体差分机", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr突破材料", + "name": "突破材料", "desc": "获取角色突破材料图鉴", - "eg": "sr突破材料 希儿", + "eg": "突破材料 希儿", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "sr武器", + "name": "武器", "desc": "查询武器图鉴", - "eg": "sr武器 于夜色中", + "eg": "武器 于夜色中", "need_ck": false, "need_sk": false, "need_admin": false @@ -167,9 +175,9 @@ "desc": "一些仅供私聊调用的服务", "data": [ { - "name": "sr导入抽卡链接", + "name": "导入抽卡链接", "desc": "后跟抽卡记录连接以导入", - "eg": "sr导入抽卡链接", + "eg": "导入抽卡链接", "need_ck": false, "need_sk": false, "need_admin": false @@ -180,17 +188,17 @@ "desc": "一些仅供管理员调用的服务", "data": [ { - "name": "sr下载全部资源", + "name": "下载全部资源", "desc": "下载一些机器人必须的资源", - "eg": "sr下载全部资源", + "eg": "下载全部资源", "need_ck": false, "need_sk": false, "need_admin": true }, { - "name": "sr强制推送体力提醒", + "name": "强制推送体力提醒", "desc": "强制推送一次体力提醒", - "eg": "sr强制推送体力提醒", + "eg": "强制推送体力提醒", "need_ck": false, "need_sk": false, "need_admin": true diff --git a/StarRailUID/starrailuid_help/__init__.py b/StarRailUID/starrailuid_help/__init__.py index 828bf3b..710f6a0 100644 --- a/StarRailUID/starrailuid_help/__init__.py +++ b/StarRailUID/starrailuid_help/__init__.py @@ -6,7 +6,7 @@ from gsuid_core.logger import logger from gsuid_core.help.utils import register_help from ..utils.sr_prefix import PREFIX -from .get_help import ICON, get_core_help +from .get_help import ICON, get_help sv_sr_help = SV("sr帮助") @@ -14,7 +14,7 @@ sv_sr_help = SV("sr帮助") @sv_sr_help.on_fullmatch(f"{PREFIX}帮助") async def send_help_img(bot: Bot, ev: Event): logger.info("开始执行[sr帮助]") - im = await get_core_help() + im = await get_help() await bot.send(im) register_help('StarRailUID', f'{PREFIX}帮助', Image.open(ICON)) diff --git a/StarRailUID/starrailuid_help/get_help.py b/StarRailUID/starrailuid_help/get_help.py index c01342f..ef98551 100644 --- a/StarRailUID/starrailuid_help/get_help.py +++ b/StarRailUID/starrailuid_help/get_help.py @@ -1,39 +1,41 @@ +from typing import Dict from pathlib import Path -from typing import Dict, Union, Optional +import aiofiles from PIL import Image from msgspec import json as msgjson from gsuid_core.help.model import PluginHelp -from gsuid_core.help.draw_plugin_help import get_help +from gsuid_core.help.draw_new_plugin_help import get_new_help -from ..version import StarRail_version -from ..utils.fonts.starrail_fonts import starrail_font_origin +from ..utils.image import get_footer +from ..utils.sr_prefix import PREFIX +from ..version import StarRailUID_version -TEXT_PATH = Path(__file__).parent / "texture2d" -HELP_DATA = Path(__file__).parent / "Help.json" ICON = Path(__file__).parent.parent.parent / 'ICON.png' +HELP_DATA = Path(__file__).parent / 'help.json' +ICON_PATH = Path(__file__).parent / 'icon_path' +TEXT_PATH = Path(__file__).parent / 'texture2d' -async def get_help_data() -> Optional[Dict[str, PluginHelp]]: - if HELP_DATA.exists(): - with Path.open(HELP_DATA, "rb") as file: - return msgjson.decode(file.read(), type=Dict[str, PluginHelp]) - return None +async def get_help_data() -> Dict[str, PluginHelp]: + async with aiofiles.open(HELP_DATA, 'rb') as file: + return msgjson.decode(await file.read(), type=Dict[str, PluginHelp]) -async def get_core_help() -> Union[bytes, str]: - help_data = await get_help_data() - if help_data is None: - return "暂未找到帮助数据..." - - return await get_help( - "StarRailUID", - f"版本号:{StarRail_version}", - help_data, - Image.open(TEXT_PATH / "bg.jpg"), - Image.open(TEXT_PATH / "ICON.png"), - Image.open(TEXT_PATH / "badge.png"), - Image.open(TEXT_PATH / "banner.png"), - Image.open(TEXT_PATH / "button.png"), - starrail_font_origin, +async def get_help(): + return await get_new_help( + plugin_name='StarRailUID', + plugin_info={f'v{StarRailUID_version}': ''}, + plugin_icon=Image.open(ICON), + plugin_help=await get_help_data(), + plugin_prefix=PREFIX, + help_mode='dark', + banner_bg=Image.open(TEXT_PATH / 'banner_bg.jpg'), + banner_sub_text='「愿此行, 终抵群星!」', + help_bg=Image.open(TEXT_PATH / 'bg.jpg'), + cag_bg=Image.open(TEXT_PATH / 'cag_bg.png'), + item_bg=Image.open(TEXT_PATH / 'item.png'), + icon_path=ICON_PATH, + footer=get_footer(), + enable_cache=True, ) diff --git a/StarRailUID/starrailuid_help/icon_path/mr.png b/StarRailUID/starrailuid_help/icon_path/mr.png new file mode 100644 index 0000000..46a69e7 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/mr.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/下载全部资源.png b/StarRailUID/starrailuid_help/icon_path/下载全部资源.png new file mode 100644 index 0000000..3bb8df7 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/下载全部资源.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/切换.png b/StarRailUID/starrailuid_help/icon_path/切换.png new file mode 100644 index 0000000..08ed056 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/切换.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/删除.png b/StarRailUID/starrailuid_help/icon_path/删除.png new file mode 100644 index 0000000..76982e7 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/删除.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/寰宇蝗灾.png b/StarRailUID/starrailuid_help/icon_path/寰宇蝗灾.png new file mode 100644 index 0000000..0a513e6 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/寰宇蝗灾.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/导入抽卡链接.png b/StarRailUID/starrailuid_help/icon_path/导入抽卡链接.png new file mode 100644 index 0000000..55e5c8f Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/导入抽卡链接.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/强制刷新.png b/StarRailUID/starrailuid_help/icon_path/强制刷新.png new file mode 100644 index 0000000..da38f2d Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/强制刷新.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/强制推送体力提醒.png b/StarRailUID/starrailuid_help/icon_path/强制推送体力提醒.png new file mode 100644 index 0000000..fcf3e8e Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/强制推送体力提醒.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/当前状态.png b/StarRailUID/starrailuid_help/icon_path/当前状态.png new file mode 100644 index 0000000..c4a45e8 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/当前状态.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/抽卡记录.png b/StarRailUID/starrailuid_help/icon_path/抽卡记录.png new file mode 100644 index 0000000..fe5bb44 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/抽卡记录.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/攻略.png b/StarRailUID/starrailuid_help/icon_path/攻略.png new file mode 100644 index 0000000..47cfa03 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/攻略.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/札记.png b/StarRailUID/starrailuid_help/icon_path/札记.png new file mode 100644 index 0000000..6f1df6d Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/札记.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/查询.png b/StarRailUID/starrailuid_help/icon_path/查询.png new file mode 100644 index 0000000..1c95ae7 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/查询.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/查询[角色].png b/StarRailUID/starrailuid_help/icon_path/查询[角色].png new file mode 100644 index 0000000..ba81ffc Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/查询[角色].png differ diff --git a/StarRailUID/starrailuid_help/icon_path/模拟宇宙.png b/StarRailUID/starrailuid_help/icon_path/模拟宇宙.png new file mode 100644 index 0000000..416be07 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/模拟宇宙.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/武器.png b/StarRailUID/starrailuid_help/icon_path/武器.png new file mode 100644 index 0000000..1dcd3f0 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/武器.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/每月统计.png b/StarRailUID/starrailuid_help/icon_path/每月统计.png new file mode 100644 index 0000000..086d061 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/每月统计.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/深渊.png b/StarRailUID/starrailuid_help/icon_path/深渊.png new file mode 100644 index 0000000..f924622 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/深渊.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/添加.png b/StarRailUID/starrailuid_help/icon_path/添加.png new file mode 100644 index 0000000..4ebfde5 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/添加.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/突破材料.png b/StarRailUID/starrailuid_help/icon_path/突破材料.png new file mode 100644 index 0000000..fb1e27d Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/突破材料.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/签到.png b/StarRailUID/starrailuid_help/icon_path/签到.png new file mode 100644 index 0000000..23ddfcf Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/签到.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/练度统计.png b/StarRailUID/starrailuid_help/icon_path/练度统计.png new file mode 100644 index 0000000..d65c66a Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/练度统计.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/虚构叙事.png b/StarRailUID/starrailuid_help/icon_path/虚构叙事.png new file mode 100644 index 0000000..eb2955c Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/虚构叙事.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/通用.png b/StarRailUID/starrailuid_help/icon_path/通用.png new file mode 100644 index 0000000..2b4dee9 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/通用.png differ diff --git a/StarRailUID/starrailuid_help/icon_path/遗器.png b/StarRailUID/starrailuid_help/icon_path/遗器.png new file mode 100644 index 0000000..6d0b626 Binary files /dev/null and b/StarRailUID/starrailuid_help/icon_path/遗器.png differ diff --git a/StarRailUID/starrailuid_help/texture2d/ICON.png b/StarRailUID/starrailuid_help/texture2d/ICON.png deleted file mode 100644 index 578e2be..0000000 Binary files a/StarRailUID/starrailuid_help/texture2d/ICON.png and /dev/null differ diff --git a/StarRailUID/starrailuid_help/texture2d/badge.png b/StarRailUID/starrailuid_help/texture2d/badge.png deleted file mode 100644 index 66bddff..0000000 Binary files a/StarRailUID/starrailuid_help/texture2d/badge.png and /dev/null differ diff --git a/StarRailUID/starrailuid_help/texture2d/banner.png b/StarRailUID/starrailuid_help/texture2d/banner.png deleted file mode 100644 index 0c9c54d..0000000 Binary files a/StarRailUID/starrailuid_help/texture2d/banner.png and /dev/null differ diff --git a/StarRailUID/starrailuid_help/texture2d/banner_bg.jpg b/StarRailUID/starrailuid_help/texture2d/banner_bg.jpg new file mode 100644 index 0000000..4d2f6af Binary files /dev/null and b/StarRailUID/starrailuid_help/texture2d/banner_bg.jpg differ diff --git a/StarRailUID/starrailuid_help/texture2d/bg.jpg b/StarRailUID/starrailuid_help/texture2d/bg.jpg index 2c6b897..b59f5df 100644 Binary files a/StarRailUID/starrailuid_help/texture2d/bg.jpg and b/StarRailUID/starrailuid_help/texture2d/bg.jpg differ diff --git a/StarRailUID/starrailuid_help/texture2d/button.png b/StarRailUID/starrailuid_help/texture2d/button.png deleted file mode 100644 index 79ebc0e..0000000 Binary files a/StarRailUID/starrailuid_help/texture2d/button.png and /dev/null differ diff --git a/StarRailUID/starrailuid_help/texture2d/cag_bg.png b/StarRailUID/starrailuid_help/texture2d/cag_bg.png new file mode 100644 index 0000000..2612715 Binary files /dev/null and b/StarRailUID/starrailuid_help/texture2d/cag_bg.png differ diff --git a/StarRailUID/starrailuid_help/texture2d/item.png b/StarRailUID/starrailuid_help/texture2d/item.png new file mode 100644 index 0000000..3125a48 Binary files /dev/null and b/StarRailUID/starrailuid_help/texture2d/item.png differ diff --git a/StarRailUID/utils/image.py b/StarRailUID/utils/image.py new file mode 100644 index 0000000..4cd4c80 --- /dev/null +++ b/StarRailUID/utils/image.py @@ -0,0 +1,9 @@ +from pathlib import Path + +from PIL import Image + +TEXT_PATH = Path(__file__).parent / 'texture2d' + + +def get_footer(): + return Image.open(TEXT_PATH / 'footer.png') diff --git a/StarRailUID/utils/texture2d/footer.png b/StarRailUID/utils/texture2d/footer.png new file mode 100644 index 0000000..c6c86c6 Binary files /dev/null and b/StarRailUID/utils/texture2d/footer.png differ