diff --git a/BlueArchiveUID/bauid_guide/__init__.py b/BlueArchiveUID/bauid_guide/__init__.py index 76ffd95..c2ecc4d 100644 --- a/BlueArchiveUID/bauid_guide/__init__.py +++ b/BlueArchiveUID/bauid_guide/__init__.py @@ -15,7 +15,7 @@ char_source: List[str] = ba_config.get_config('char_guide_source').data -@sv_ba_wiki.on_prefix(('ba角色攻略', 'BA角色攻略')) +@sv_ba_wiki.on_prefix(('角色攻略')) async def send_ba_char_pic(bot: Bot, ev: Event): msg_list = [] for s in char_source: @@ -34,7 +34,7 @@ async def send_ba_char_pic(bot: Bot, ev: Event): await bot.send('未找到相关的攻略信息!') -@sv_ba_guide.on_prefix(('ba攻略', 'BA攻略')) +@sv_ba_guide.on_prefix(('攻略')) async def send_ba_stage_pic(bot: Bot, ev: Event): im = await get_guide_img(ev.text) if isinstance(im, str): @@ -44,6 +44,6 @@ async def send_ba_stage_pic(bot: Bot, ev: Event): await bot.send(img) -@sv_ba_guide.on_fullmatch(('ba活动攻略', 'BA活动攻略')) +@sv_ba_guide.on_fullmatch(('活动攻略')) async def send_event_guide_pic(bot: Bot, ev: Event): await bot.send(await get_event_img()) diff --git a/BlueArchiveUID/bauid_help/Help.json b/BlueArchiveUID/bauid_help/Help.json index bf71d96..059c18f 100644 --- a/BlueArchiveUID/bauid_help/Help.json +++ b/BlueArchiveUID/bauid_help/Help.json @@ -3,46 +3,96 @@ "desc": "一些基础的查询功能", "data": [ { - "name": "ba攻略", + "name": "攻略", "desc": "获取主线任务走格子攻略", - "eg": "ba攻略16-3H", + "eg": "攻略16-3H", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "ba角色攻略", - "desc": "获取BA的角色的养成攻略", - "eg": "ba角色攻略优香", + "name": "角色攻略", + "desc": "获取的角色的养成攻略", + "eg": "角色攻略优香", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "ba活动攻略", + "name": "活动攻略", "desc": "获取当期活动攻略", - "eg": "ba活动攻略", + "eg": "活动攻略", "need_ck": false, "need_sk": false, "need_admin": false } ] }, - "什亭之匣相关": { + "总力战相关": { "desc": "数据来源arona.icu,需要申请Token使用", "data": [ { - "name": "ba总力战", + "name": "总力战", "desc": "获取当期国服总力战的档线信息", - "eg": "ba总力战", + "eg": "总力战", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "ba总力战b", + "name": "总力战b", "desc": "获取当期B服总力战的档线信息", - "eg": "ba总力战b", + "eg": "总力战b", + "need_ck": false, + "need_sk": false, + "need_admin": false + } + ] + }, + "绑定好友码": { + "desc": "在执行查询之前请绑定账号", + "data": [ + { + "name": "绑定好友码", + "desc": "绑定自己的账户", + "eg": "绑定好友码vlhy4mw:1", + "need_ck": false, + "need_sk": false, + "need_admin": false + }, + { + "name": "切换好友码", + "desc": "切换绑定的账户", + "eg": "切换好友码", + "need_ck": true, + "need_sk": false, + "need_admin": false + }, + { + "name": "删除好友码", + "desc": "解除绑定", + "eg": "删除好友码vlhy4mw:1", + "need_ck": false, + "need_sk": false, + "need_admin": false + } + ] + }, + "信息查询相关": { + "desc": "数据来源arona.icu,请在使用前进行【绑定】", + "data": [ + { + "name": "查询", + "desc": "获取当期国服总力战的档线信息", + "eg": "查询vlhy4mw:1", + "need_ck": false, + "need_sk": false, + "need_admin": false + }, + { + "name": "角色排名", + "desc": "获取全服的角色好感排名", + "eg": "角色排名星野", "need_ck": false, "need_sk": false, "need_admin": false @@ -53,17 +103,25 @@ "desc": "一些和计算相关的服务", "data": [ { - "name": "ba用时", + "name": "用时", "desc": "根据分数计算用时", - "eg": "ba用时寿司1300w", + "eg": "用时寿司1300w", "need_ck": false, "need_sk": false, "need_admin": false }, { - "name": "ba算分", + "name": "算分", "desc": "根据时间计算分数", - "eg": "ba算分ex寿司剩1:23.43", + "eg": "算分ex寿司剩1:23.43", + "need_ck": false, + "need_sk": false, + "need_admin": false + }, + { + "name": "jjc挖矿", + "desc": "计算竞技场挖矿数量", + "eg": "jjc挖矿", "need_ck": false, "need_sk": false, "need_admin": false @@ -74,9 +132,9 @@ "desc": "一些杂项服务", "data": [ { - "name": "ba帮助", + "name": "帮助", "desc": "呼出该帮助界面", - "eg": "ba帮助", + "eg": "帮助", "need_ck": false, "need_sk": false, "need_admin": false diff --git a/BlueArchiveUID/bauid_help/__init__.py b/BlueArchiveUID/bauid_help/__init__.py index 4ed945c..08e6f52 100644 --- a/BlueArchiveUID/bauid_help/__init__.py +++ b/BlueArchiveUID/bauid_help/__init__.py @@ -5,15 +5,15 @@ from gsuid_core.logger import logger from gsuid_core.help.utils import register_help -from .get_help import ICON, get_ba_core_help +from .get_help import ICON, get_help sv_ba_help = SV('BA帮助') -@sv_ba_help.on_fullmatch(('ba帮助', '蔚蓝档案帮助', 'BA帮助')) +@sv_ba_help.on_fullmatch(('帮助', '蔚蓝档案帮助')) async def send_help_img(bot: Bot, ev: Event): logger.info('开始执行[ba帮助]') - im = await get_ba_core_help() + im = await get_help() await bot.send(im) diff --git a/BlueArchiveUID/bauid_help/get_help.py b/BlueArchiveUID/bauid_help/get_help.py index 7707971..39f05c9 100644 --- a/BlueArchiveUID/bauid_help/get_help.py +++ b/BlueArchiveUID/bauid_help/get_help.py @@ -1,51 +1,40 @@ +from typing import Dict from pathlib import Path -from typing import Dict, Union import aiofiles from PIL import Image from msgspec import json as msgjson from gsuid_core.help.model import PluginHelp -from gsuid_core.utils.fonts.fonts import core_font -from gsuid_core.help.draw_plugin_help import get_help +from gsuid_core.help.draw_new_plugin_help import get_new_help +from ..utils.image import get_footer from ..version import BlueArchiveUID_version 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' -HELP_DATA = Path(__file__).parent / 'Help.json' -async def get_help_data() -> Union[Dict[str, PluginHelp], None]: - if HELP_DATA.exists(): - async with aiofiles.open(HELP_DATA, 'rb') as file: - return msgjson.decode( - await file.read(), - type=Dict[str, PluginHelp], - ) - - -async def get_ba_core_help() -> Union[bytes, str]: - help_data = await get_help_data() - if help_data is None: - return '暂未找到帮助数据...' - - img = await get_help( - 'BlueArchiveUID', - f'版本号:{BlueArchiveUID_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'), - core_font, - is_dark=False, - column=4, - is_gaussian=True, - gaussian_blur=10, - text_color=(39, 87, 168), - sub_c=(68, 128, 230), - sv_color=(8, 8, 8), - sv_desc_color=(58, 58, 58), +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_help(): + return await get_new_help( + plugin_name='BlueArchiveUID', + plugin_info={f'v{BlueArchiveUID_version}': ''}, + plugin_icon=Image.open(ICON), + plugin_help=await get_help_data(), + plugin_prefix='ba', + help_mode='light', + 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, ) - return img diff --git "a/BlueArchiveUID/bauid_help/icon_path/\345\210\207\346\215\242.png" "b/BlueArchiveUID/bauid_help/icon_path/\345\210\207\346\215\242.png" new file mode 100644 index 0000000..2cfb004 Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\345\210\207\346\215\242.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\345\210\240\351\231\244.png" "b/BlueArchiveUID/bauid_help/icon_path/\345\210\240\351\231\244.png" new file mode 100644 index 0000000..7da99e7 Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\345\210\240\351\231\244.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\345\270\256\345\212\251.png" "b/BlueArchiveUID/bauid_help/icon_path/\345\270\256\345\212\251.png" new file mode 100644 index 0000000..45e3b8d Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\345\270\256\345\212\251.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\346\200\273\345\212\233\346\210\230.png" "b/BlueArchiveUID/bauid_help/icon_path/\346\200\273\345\212\233\346\210\230.png" new file mode 100644 index 0000000..0f53bfb Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\346\200\273\345\212\233\346\210\230.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\346\214\226\347\237\277.png" "b/BlueArchiveUID/bauid_help/icon_path/\346\214\226\347\237\277.png" new file mode 100644 index 0000000..e1bd98b Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\346\214\226\347\237\277.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\346\224\273\347\225\245.png" "b/BlueArchiveUID/bauid_help/icon_path/\346\224\273\347\225\245.png" new file mode 100644 index 0000000..d8cdcca Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\346\224\273\347\225\245.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\346\237\245\350\257\242.png" "b/BlueArchiveUID/bauid_help/icon_path/\346\237\245\350\257\242.png" new file mode 100644 index 0000000..be9ada4 Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\346\237\245\350\257\242.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\346\264\273\345\212\250\346\224\273\347\225\245.png" "b/BlueArchiveUID/bauid_help/icon_path/\346\264\273\345\212\250\346\224\273\347\225\245.png" new file mode 100644 index 0000000..3dc6187 Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\346\264\273\345\212\250\346\224\273\347\225\245.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\347\224\250\346\227\266.png" "b/BlueArchiveUID/bauid_help/icon_path/\347\224\250\346\227\266.png" new file mode 100644 index 0000000..cea1fba Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\347\224\250\346\227\266.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\347\256\227\345\210\206.png" "b/BlueArchiveUID/bauid_help/icon_path/\347\256\227\345\210\206.png" new file mode 100644 index 0000000..71d9bee Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\347\256\227\345\210\206.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\347\273\221\345\256\232.png" "b/BlueArchiveUID/bauid_help/icon_path/\347\273\221\345\256\232.png" new file mode 100644 index 0000000..f2da03e Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\347\273\221\345\256\232.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\216\222\345\220\215.png" "b/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\216\222\345\220\215.png" new file mode 100644 index 0000000..cca1f2e Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\216\222\345\220\215.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\224\273\347\225\245.png" "b/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\224\273\347\225\245.png" new file mode 100644 index 0000000..73c701d Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\350\247\222\350\211\262\346\224\273\347\225\245.png" differ diff --git "a/BlueArchiveUID/bauid_help/icon_path/\351\200\232\347\224\250.png" "b/BlueArchiveUID/bauid_help/icon_path/\351\200\232\347\224\250.png" new file mode 100644 index 0000000..6afa52c Binary files /dev/null and "b/BlueArchiveUID/bauid_help/icon_path/\351\200\232\347\224\250.png" differ diff --git a/BlueArchiveUID/bauid_help/texture2d/badge.png b/BlueArchiveUID/bauid_help/texture2d/badge.png deleted file mode 100644 index deeda4b..0000000 Binary files a/BlueArchiveUID/bauid_help/texture2d/badge.png and /dev/null differ diff --git a/BlueArchiveUID/bauid_help/texture2d/banner.png b/BlueArchiveUID/bauid_help/texture2d/banner.png deleted file mode 100644 index 6eef975..0000000 Binary files a/BlueArchiveUID/bauid_help/texture2d/banner.png and /dev/null differ diff --git a/BlueArchiveUID/bauid_help/texture2d/banner_bg.jpg b/BlueArchiveUID/bauid_help/texture2d/banner_bg.jpg new file mode 100644 index 0000000..a91d383 Binary files /dev/null and b/BlueArchiveUID/bauid_help/texture2d/banner_bg.jpg differ diff --git a/BlueArchiveUID/bauid_help/texture2d/bg.jpg b/BlueArchiveUID/bauid_help/texture2d/bg.jpg index d1339ef..a295a35 100644 Binary files a/BlueArchiveUID/bauid_help/texture2d/bg.jpg and b/BlueArchiveUID/bauid_help/texture2d/bg.jpg differ diff --git a/BlueArchiveUID/bauid_help/texture2d/button.png b/BlueArchiveUID/bauid_help/texture2d/button.png deleted file mode 100644 index bedd5d7..0000000 Binary files a/BlueArchiveUID/bauid_help/texture2d/button.png and /dev/null differ diff --git a/BlueArchiveUID/bauid_help/texture2d/cag_bg.png b/BlueArchiveUID/bauid_help/texture2d/cag_bg.png new file mode 100644 index 0000000..5904268 Binary files /dev/null and b/BlueArchiveUID/bauid_help/texture2d/cag_bg.png differ diff --git a/BlueArchiveUID/bauid_help/texture2d/icon.png b/BlueArchiveUID/bauid_help/texture2d/icon.png deleted file mode 100644 index 102be94..0000000 Binary files a/BlueArchiveUID/bauid_help/texture2d/icon.png and /dev/null differ diff --git a/BlueArchiveUID/bauid_help/texture2d/item.png b/BlueArchiveUID/bauid_help/texture2d/item.png new file mode 100644 index 0000000..8993328 Binary files /dev/null and b/BlueArchiveUID/bauid_help/texture2d/item.png differ diff --git a/BlueArchiveUID/bauid_info/__init__.py b/BlueArchiveUID/bauid_info/__init__.py index a573bf2..d49cbee 100644 --- a/BlueArchiveUID/bauid_info/__init__.py +++ b/BlueArchiveUID/bauid_info/__init__.py @@ -9,7 +9,7 @@ ba_user_info = SV('ba用户信息') -@ba_user_info.on_command(('ba查询'), block=True) +@ba_user_info.on_command(('查询'), block=True) async def send_ba_user_info(bot: Bot, ev: Event): fcode, user_id = await get_uid( bot, ev, BaBind, partten=r'[A-Za-z0-9::]+', get_user_id=True diff --git a/BlueArchiveUID/bauid_raid/__init__.py b/BlueArchiveUID/bauid_raid/__init__.py index 56e39e0..097bfca 100644 --- a/BlueArchiveUID/bauid_raid/__init__.py +++ b/BlueArchiveUID/bauid_raid/__init__.py @@ -10,6 +10,7 @@ sv_ba_xtzx_raid = SV('BA什亭之匣总力战') +# 无用 @sv_ba_raid.on_command(('总力战档位')) async def send_raid_msg(bot: Bot, ev: Event): match = re.search(r'\d+', ev.text) @@ -17,7 +18,7 @@ async def send_raid_msg(bot: Bot, ev: Event): await bot.send(await get_ranking(season)) -@sv_ba_xtzx_raid.on_command(('ba总力战', 'BA总力战', 'ba档线', 'ba挡线')) +@sv_ba_xtzx_raid.on_command(('总力战', '档线', '挡线')) async def send_xtzx_msg(bot: Bot, ev: Event): if 'B' in ev.text or 'b' in ev.text: server_id = 2 diff --git a/BlueArchiveUID/bauid_ranklist/__init__.py b/BlueArchiveUID/bauid_ranklist/__init__.py index 65baae7..f22b119 100644 --- a/BlueArchiveUID/bauid_ranklist/__init__.py +++ b/BlueArchiveUID/bauid_ranklist/__init__.py @@ -9,10 +9,10 @@ @sv_ba_xtzx_rank.on_command( ( - 'ba学生排行', - 'ba学生排名', - 'ba角色排名', - 'ba角色排行', + '学生排行', + '学生排名', + '角色排名', + '角色排行', ) ) async def send_rank_msg(bot: Bot, ev: Event): diff --git a/BlueArchiveUID/bauid_score/__init__.py b/BlueArchiveUID/bauid_score/__init__.py index bc45dac..5b75548 100644 --- a/BlueArchiveUID/bauid_score/__init__.py +++ b/BlueArchiveUID/bauid_score/__init__.py @@ -10,7 +10,7 @@ sv_ba_time = SV('BA总力战算用时') -@sv_ba_score.on_command(('ba算分', 'BA算分')) +@sv_ba_score.on_command(('算分')) async def send_score_msg(bot: Bot, ev: Event): if not ev.text: await bot.send( @@ -30,7 +30,7 @@ async def send_score_msg(bot: Bot, ev: Event): await bot.send('请检查指令词 用时/算分 或格式 用/剩,重新发送指令') -@sv_ba_time.on_command(('ba用时', 'BA用时')) +@sv_ba_time.on_command(('用时')) async def send_time_msg(bot: Bot, ev: Event): if not ev.text: await bot.send( diff --git a/BlueArchiveUID/bauid_user/__init__.py b/BlueArchiveUID/bauid_user/__init__.py index 77ca7ee..f440379 100644 --- a/BlueArchiveUID/bauid_user/__init__.py +++ b/BlueArchiveUID/bauid_user/__init__.py @@ -10,16 +10,16 @@ @ba_user_bind.on_command( ( - 'ba绑定uid', - 'ba绑定UID', - 'ba绑定', - 'ba好友码', - 'ba切换uid', - 'ba切换UID', - 'ba切换', - 'ba删除uid', - 'ba删除UID', - 'ba删除', + '绑定uid', + '绑定UID', + '绑定', + '好友码', + '切换uid', + '切换UID', + '切换', + '删除uid', + '删除UID', + '删除', ), block=True, ) diff --git a/BlueArchiveUID/utils/image.py b/BlueArchiveUID/utils/image.py new file mode 100644 index 0000000..4cd4c80 --- /dev/null +++ b/BlueArchiveUID/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/BlueArchiveUID/utils/texture2d/footer.png b/BlueArchiveUID/utils/texture2d/footer.png new file mode 100644 index 0000000..844d2f1 Binary files /dev/null and b/BlueArchiveUID/utils/texture2d/footer.png differ diff --git a/BlueArchiveUID/version.py b/BlueArchiveUID/version.py index 53983f4..934497a 100644 --- a/BlueArchiveUID/version.py +++ b/BlueArchiveUID/version.py @@ -1 +1 @@ -BlueArchiveUID_version = '0.2' +BlueArchiveUID_version = '0.3' diff --git a/__init__.py b/__init__.py index e69de29..1e06e08 100644 --- a/__init__.py +++ b/__init__.py @@ -0,0 +1,7 @@ +from gsuid_core.sv import Plugins + +Plugins( + name="BlueArchiveUID", + force_prefix=["ba", "BA"], + allow_empty_prefix=False, +)