From c90c3931873fbd35095304e61512d34ed4b2769b Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Wed, 6 Dec 2023 03:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenshinUID/genshinuid_guide/__init__.py | 10 +++++++++- GenshinUID/genshinuid_resource/__init__.py | 2 +- GenshinUID/genshinuid_user/__init__.py | 12 ++++++++++++ GenshinUID/utils/image/image_tools.py | 1 + GenshinUID/utils/message.py | 16 +++++++++++++--- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/GenshinUID/genshinuid_guide/__init__.py b/GenshinUID/genshinuid_guide/__init__.py index 32bb6a75..3d27a354 100644 --- a/GenshinUID/genshinuid_guide/__init__.py +++ b/GenshinUID/genshinuid_guide/__init__.py @@ -71,7 +71,15 @@ async def send_abyss_review(bot: Bot, ev: Event): im = await get_review(version) if isinstance(im, bytes): - await bot.send(im) + c = Button('♾️深渊概览', '深渊概览') + input_version = float(version) + now_version = float(Genshin_version[:-2]) + if input_version <= now_version: + adv_version = now_version + 0.1 + else: + adv_version = now_version + d = Button(f'♾️版本深渊{adv_version}', f'深渊概览{adv_version}') + await bot.send_option(im, [c, d]) elif isinstance(im, List): mes = [MessageSegment.text(msg) for msg in im] await bot.send(MessageSegment.node(mes)) diff --git a/GenshinUID/genshinuid_resource/__init__.py b/GenshinUID/genshinuid_resource/__init__.py index 8aabfca4..32fb0b83 100644 --- a/GenshinUID/genshinuid_resource/__init__.py +++ b/GenshinUID/genshinuid_resource/__init__.py @@ -8,7 +8,7 @@ from ..utils.resource.download_all_resource import download_all_resource sv_download_config = SV('下载资源', pm=2) -@sv_download_config.on_fullmatch(('下载全部资源')) +@sv_download_config.on_fullmatch(('下载全部资源', 'gs下载全部资源')) async def send_download_resource_msg(bot: Bot, ev: Event): await bot.send('正在开始下载~可能需要较久的时间!') im = await download_all_resource() diff --git a/GenshinUID/genshinuid_user/__init__.py b/GenshinUID/genshinuid_user/__init__.py index 8c8f5e87..f8dcd7b9 100644 --- a/GenshinUID/genshinuid_user/__init__.py +++ b/GenshinUID/genshinuid_user/__init__.py @@ -1,6 +1,7 @@ from gsuid_core.sv import SV from gsuid_core.bot import Bot from gsuid_core.models import Event +from gsuid_core.message_models import Button from gsuid_core.segment import MessageSegment from gsuid_core.utils.database.models import GsBind @@ -21,6 +22,14 @@ async def send_link_uid_msg(bot: Bot, ev: Event): if uid and not uid.isdigit(): return await bot.send('你输入了错误的格式!') + a = Button('🔍查询探索', '查询探索') + b = Button('🔍查询收集', '查询收集') + c = Button('💖刷新面板', '刷新面板') + d2 = Button('🔔绑定UID', '绑定uid') + d = Button('🔔绑定更多UID', '绑定uid') + e = Button('🔄切换UID', '切换UID') + f = Button('❌删除uid', '删除uid') + if '绑定' in ev.command: data = await GsBind.insert_uid(qid, ev.bot_id, uid, ev.group_id, 9) return await send_diff_msg( @@ -32,6 +41,7 @@ async def send_link_uid_msg(bot: Bot, ev: Event): -2: f'UID{uid}已经绑定过了!', -3: '你输入了错误的格式!', }, + [[d, e, f], [a, b, c]], ) elif '切换' in ev.command: data = await GsBind.switch_uid_by_game(qid, ev.bot_id, uid) @@ -44,6 +54,7 @@ async def send_link_uid_msg(bot: Bot, ev: Event): -2: f'UID{uid}不在绑定列表中!', -3: '请绑定大于等于两个UID以进行切换!', }, + [[d, e, f], [a, b, c]], ) else: data = await GsBind.delete_uid(qid, ev.bot_id, uid) @@ -54,6 +65,7 @@ async def send_link_uid_msg(bot: Bot, ev: Event): 0: f'删除UID{uid}成功!', -1: f'该UID{uid}不在已绑定列表中!', }, + [[d2, e, f]], ) diff --git a/GenshinUID/utils/image/image_tools.py b/GenshinUID/utils/image/image_tools.py index 0a5a5799..0cbf40c0 100644 --- a/GenshinUID/utils/image/image_tools.py +++ b/GenshinUID/utils/image/image_tools.py @@ -270,6 +270,7 @@ async def draw_pic_with_ring( mask = mask_pic.resize((size, size)) ring = ring_pic.resize((size, size)) resize_pic = crop_center_img(pic, size, size) + resize_pic = resize_pic.convert('RGBA') if bg_color: img_color = Image.new('RGBA', (size, size), bg_color) img_color.paste(resize_pic, (0, 0), resize_pic) diff --git a/GenshinUID/utils/message.py b/GenshinUID/utils/message.py index 3f58bd74..5f962b27 100644 --- a/GenshinUID/utils/message.py +++ b/GenshinUID/utils/message.py @@ -1,9 +1,17 @@ -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Union, Optional from gsuid_core.bot import Bot +from gsuid_core.message_models import Button -async def send_diff_msg(bot: Bot, code: Any, data: Optional[Dict] = None): +async def send_diff_msg( + bot: Bot, + code: Any, + data: Optional[Dict] = None, + option_list: Optional[ + Union[List[str], List[Button], List[List[str]], List[List[Button]]] + ] = None, +): if data is None: data = { 0: '绑定UID成功!', @@ -13,4 +21,6 @@ async def send_diff_msg(bot: Bot, code: Any, data: Optional[Dict] = None): } for retcode in data: if code == retcode: - return await bot.send(data[retcode]) + return await bot.send_option( + data[retcode], option_list, True, '\n' + )