🎨 支持UIGF2.2导出抽卡记录

This commit is contained in:
Wuyi无疑 2023-03-22 23:45:41 +08:00
parent 2465a1753a
commit 537aa476eb
7 changed files with 32 additions and 9 deletions

3
.gitignore vendored
View File

@ -679,6 +679,9 @@ AvatarExcelConfigData.json
曲线素材.xlsx
参考面板.xlsx
textMap.json
event.jpg
gacha.jpg
help.png
### Debug ###
testnb2/

View File

@ -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)

View File

@ -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('导出抽卡记录失败...')

View File

@ -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': [],
}

View File

@ -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)

6
poetry.lock generated
View File

@ -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]

View File

@ -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"