From 537aa476eb2ec165926de648270d4eb08a275346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Wed, 22 Mar 2023 23:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E6=94=AF=E6=8C=81`UIGF2.2`?= =?UTF-8?q?=E7=9A=84`=E5=AF=BC=E5=87=BA=E6=8A=BD=E5=8D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ GenshinUID/genshinuid_abyss/__init__.py | 2 +- GenshinUID/genshinuid_gachalog/__init__.py | 21 ++++++++++++++++++- .../genshinuid_gachalog/export_and_import.py | 5 +++-- GenshinUID/genshinuid_roleinfo/__init__.py | 2 +- poetry.lock | 6 +++--- requirements.txt | 2 +- 7 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index b151d887..62c8a61e 100644 --- a/.gitignore +++ b/.gitignore @@ -679,6 +679,9 @@ AvatarExcelConfigData.json 曲线素材.xlsx 参考面板.xlsx textMap.json +event.jpg +gacha.jpg +help.png ### Debug ### testnb2/ diff --git a/GenshinUID/genshinuid_abyss/__init__.py b/GenshinUID/genshinuid_abyss/__init__.py index 36bf47d3..588de649 100644 --- a/GenshinUID/genshinuid_abyss/__init__.py +++ b/GenshinUID/genshinuid_abyss/__init__.py @@ -7,7 +7,7 @@ from ..utils.error_reply import UID_HINT from .draw_abyss_card import draw_abyss_img -@SV('查询深渊').on_command(('查询深渊', 'sy', '查询上期深渊', 'sqsy')) +@SV('查询深渊').on_command(('查询深渊', 'sy', '查询上期深渊', 'sqsy'), block=True) async def send_abyss_info(bot: Bot, ev: Event): await bot.logger.info('开始执行[查询深渊信息]') uid = await get_uid(bot, ev) diff --git a/GenshinUID/genshinuid_gachalog/__init__.py b/GenshinUID/genshinuid_gachalog/__init__.py index 5961935f..0a722119 100644 --- a/GenshinUID/genshinuid_gachalog/__init__.py +++ b/GenshinUID/genshinuid_gachalog/__init__.py @@ -1,11 +1,14 @@ from gsuid_core.sv import SV from gsuid_core.bot import Bot from gsuid_core.models import Event +from gsuid_core.segment import MessageSegment from ..utils.convert import get_uid +from ..utils.database import get_sqla from ..utils.error_reply import UID_HINT from .get_gachalogs import save_gachalogs from .draw_gachalogs import draw_gachalogs_img +from .export_and_import import export_gachalogs @SV('抽卡记录').on_fullmatch(('抽卡记录')) @@ -19,7 +22,7 @@ async def send_gacha_log_card_info(bot: Bot, ev: Event): @SV('抽卡记录').on_fullmatch(('刷新抽卡记录', '强制刷新抽卡记录')) -async def send_daily_info(bot: Bot, ev: Event): +async def send_refresh_gacha_info(bot: Bot, ev: Event): await bot.logger.info('开始执行[刷新抽卡记录]') uid = await get_uid(bot, ev) if uid is None: @@ -30,3 +33,19 @@ async def send_daily_info(bot: Bot, ev: Event): is_force = True im = await save_gachalogs(uid, None, is_force) await bot.send(im) + + +@SV('抽卡记录').on_fullmatch(('导出抽卡记录')) +async def send_export_gacha_info(bot: Bot, ev: Event): + await bot.logger.info('开始执行[导出抽卡记录]') + sqla = get_sqla(ev.bot_id) + uid = await sqla.get_bind_uid(ev.user_id) + if uid is None: + return await bot.send(UID_HINT) + export = await export_gachalogs(uid) + if export['retcode'] == 'ok': + file_name = export['name'] + file_path = export['url'] + return await bot.send(MessageSegment.file(file_path, file_name)) + else: + return await bot.send('导出抽卡记录失败...') diff --git a/GenshinUID/genshinuid_gachalog/export_and_import.py b/GenshinUID/genshinuid_gachalog/export_and_import.py index b6267db7..7dd1ead8 100644 --- a/GenshinUID/genshinuid_gachalog/export_and_import.py +++ b/GenshinUID/genshinuid_gachalog/export_and_import.py @@ -54,8 +54,9 @@ async def export_gachalogs(uid: str) -> dict: 'lang': 'zh-cn', 'export_time': current_time, 'export_app': 'GenshinUID', - 'export_app_version': '3.1', - 'uigf_version': '2.1', + 'export_app_version': '4.0', + 'export_timestamp': round(now.timestamp()), + 'uigf_version': '2.2', }, 'list': [], } diff --git a/GenshinUID/genshinuid_roleinfo/__init__.py b/GenshinUID/genshinuid_roleinfo/__init__.py index da343ba0..4a0c6c08 100644 --- a/GenshinUID/genshinuid_roleinfo/__init__.py +++ b/GenshinUID/genshinuid_roleinfo/__init__.py @@ -10,7 +10,7 @@ from ..utils.error_reply import UID_HINT from .draw_roleinfo_card import draw_pic -@SV('查询注册时间').on_command(('原神注册时间', '注册时间')) +@SV('查询注册时间').on_command(('原神注册时间', '注册时间', '查询注册时间'), block=True) async def regtime(bot: Bot, ev: Event): await bot.logger.info('开始执行[查询注册时间]') uid = await get_uid(bot, ev) diff --git a/poetry.lock b/poetry.lock index ef6397f0..bd171007 100644 --- a/poetry.lock +++ b/poetry.lock @@ -615,14 +615,14 @@ test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6 [[package]] name = "fastapi-amis-admin" -version = "0.5.1" +version = "0.5.2" description = "FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by Django-admin, and has as many powerful functions as Django-admin. " category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "fastapi_amis_admin-0.5.1-py3-none-any.whl", hash = "sha256:7cb65e6389c8f132152fd185cb8832d63a2401689db92b2e0fc2cb9d8d22969c"}, - {file = "fastapi_amis_admin-0.5.1.tar.gz", hash = "sha256:da4d11fc1f68bb48c817e02b477b5673e4d8e42dfec28e29eabd3937f2b35a36"}, + {file = "fastapi_amis_admin-0.5.2-py3-none-any.whl", hash = "sha256:d45a7389c2898a5a5e01c8eae080fe5051a20a4d3e26673b8a9ea5a388464a00"}, + {file = "fastapi_amis_admin-0.5.2.tar.gz", hash = "sha256:b17fa1e5f2f746f1fd5f937405bac07b941a2fca18a2ec6d8cc41756e5f7936b"}, ] [package.dependencies] diff --git a/requirements.txt b/requirements.txt index ab2874de..2948c814 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0. dnspython==2.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0" email-validator==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" et-xmlfile==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" -fastapi-amis-admin==0.5.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" +fastapi-amis-admin==0.5.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi==0.95.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"