From 7ecbf7646e4224b60aa1cb0047ae01c556737c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Thu, 27 Apr 2023 01:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E5=B0=86=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E7=A7=BB=E5=87=BA=E5=90=AF=E5=8A=A8=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=88=97=E8=A1=A8=20(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenshinUID/genshinuid_start/__init__.py | 8 ++------ GenshinUID/genshinuid_wikitext/get_cost_pic.py | 12 ++++++------ GenshinUID/genshinuid_xkdata/__init__.py | 9 +++++++++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/GenshinUID/genshinuid_start/__init__.py b/GenshinUID/genshinuid_start/__init__.py index e9ce0c7a..71929fa4 100644 --- a/GenshinUID/genshinuid_start/__init__.py +++ b/GenshinUID/genshinuid_start/__init__.py @@ -3,26 +3,22 @@ import threading from gsuid_core.logger import logger +from ..utils.database import get_sqla from ..genshinuid_resource import startup from ..genshinuid_xkdata import draw_xk_abyss_img from ..genshinuid_help.draw_help_card import draw_help_img from ..genshinuid_guide.get_abyss_data import generate_data from ..utils.resource.generate_char_card import create_all_char_card -from ..genshinuid_xkdata.get_all_char_data import ( - save_all_char_info, - save_all_abyss_rank, -) async def all_start(): try: + get_sqla('TEMP') await draw_help_img() await startup() await create_all_char_card() await draw_xk_abyss_img() await generate_data() - await save_all_char_info() - await save_all_abyss_rank() except Exception as e: logger.exception(e) diff --git a/GenshinUID/genshinuid_wikitext/get_cost_pic.py b/GenshinUID/genshinuid_wikitext/get_cost_pic.py index c4a2f47d..cf133fd5 100644 --- a/GenshinUID/genshinuid_wikitext/get_cost_pic.py +++ b/GenshinUID/genshinuid_wikitext/get_cost_pic.py @@ -16,12 +16,6 @@ from ..utils.get_assets import get_assets_from_ambr from ..utils.map.name_covert import name_to_avatar_id from ..utils.image.convert import str_lenth, convert_img from ..utils.resource.RESOURCE_PATH import CHAR_PATH, WIKI_COST_CHAR_PATH -from ..utils.image.image_tools import ( - get_star_png, - get_simple_bg, - get_unknown_png, - draw_pic_with_ring, -) from ..utils.fonts.genshin_fonts import ( gs_font_24, gs_font_26, @@ -29,6 +23,12 @@ from ..utils.fonts.genshin_fonts import ( gs_font_36, gs_font_44, ) +from ..utils.image.image_tools import ( + get_star_png, + get_simple_bg, + get_unknown_png, + draw_pic_with_ring, +) async def get_char_cost_wiki_img(name: str) -> Union[str, bytes]: diff --git a/GenshinUID/genshinuid_xkdata/__init__.py b/GenshinUID/genshinuid_xkdata/__init__.py index ea5f4be1..27c06e6b 100644 --- a/GenshinUID/genshinuid_xkdata/__init__.py +++ b/GenshinUID/genshinuid_xkdata/__init__.py @@ -8,6 +8,7 @@ from gsuid_core.aps import scheduler from ..utils.image.convert import convert_img from .draw_abyss_total import TOTAL_IMG, draw_xk_abyss_img +from .get_all_char_data import save_all_char_info, save_all_abyss_rank sv_get_abyss_database = SV('查询深渊数据库', priority=4) @@ -18,6 +19,14 @@ async def scheduled_draw_abyss(): await draw_xk_abyss_img() +@scheduler.scheduled_job('interval', hours=11) +async def scheduled_get_xk_data(): + await asyncio.sleep(random.randint(0, 60)) + await save_all_char_info() + await asyncio.sleep(random.randint(2, 60)) + await save_all_abyss_rank() + + @sv_get_abyss_database.on_fullmatch(('深渊概览', '深渊统计', '深渊使用率'), block=True) async def send_abyss_pic(bot: Bot, ev: Event): img = await convert_img(TOTAL_IMG)