mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-08 13:06:00 +08:00
🎨 整合启动任务
This commit is contained in:
parent
63717e7929
commit
8462ae66a9
@ -7,7 +7,7 @@ from ..utils.error_reply import UID_HINT
|
|||||||
from .draw_abyss_card import draw_abyss_img
|
from .draw_abyss_card import draw_abyss_img
|
||||||
|
|
||||||
|
|
||||||
@SV('查询深渊').on_prefix(('查询深渊', 'sy', '查询上期深渊', 'sqsy'))
|
@SV('查询深渊').on_command(('查询深渊', 'sy', '查询上期深渊', 'sqsy'))
|
||||||
async def send_abyss_info(bot: Bot, ev: Event):
|
async def send_abyss_info(bot: Bot, ev: Event):
|
||||||
await bot.logger.info('开始执行[查询深渊信息]')
|
await bot.logger.info('开始执行[查询深渊信息]')
|
||||||
uid = await get_uid(bot, ev)
|
uid = await get_uid(bot, ev)
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import asyncio
|
|
||||||
import threading
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from gsuid_core.sv import SV
|
from gsuid_core.sv import SV
|
||||||
from gsuid_core.bot import Bot
|
from gsuid_core.bot import Bot
|
||||||
|
|
||||||
from .draw_help_card import draw_help_img
|
|
||||||
from ..utils.image.convert import convert_img
|
from ..utils.image.convert import convert_img
|
||||||
|
|
||||||
HELP_IMG = Path(__file__).parent / 'help.png'
|
HELP_IMG = Path(__file__).parent / 'help.png'
|
||||||
@ -16,8 +13,3 @@ async def send_guide_pic(bot: Bot):
|
|||||||
img = await convert_img(HELP_IMG)
|
img = await convert_img(HELP_IMG)
|
||||||
await bot.logger.info('获得gs帮助图片成功!')
|
await bot.logger.info('获得gs帮助图片成功!')
|
||||||
await bot.send(img)
|
await bot.send(img)
|
||||||
|
|
||||||
|
|
||||||
threading.Thread(
|
|
||||||
target=lambda: asyncio.run(draw_help_img()), daemon=True
|
|
||||||
).start()
|
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
import asyncio
|
|
||||||
import threading
|
|
||||||
|
|
||||||
from gsuid_core.sv import SV
|
from gsuid_core.sv import SV
|
||||||
from gsuid_core.bot import Bot
|
from gsuid_core.bot import Bot
|
||||||
from gsuid_core.models import Event
|
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
|
|
||||||
from ..utils.resource.download_all_resource import download_all_resource
|
from ..utils.resource.download_all_resource import download_all_resource
|
||||||
|
|
||||||
|
|
||||||
@SV('下载资源', pm=2).on_fullmatch(('深渊概览', '深渊统计', '深渊使用率'))
|
@SV('下载资源', pm=2).on_fullmatch(('下载全部资源'))
|
||||||
async def send_download_resource_msg(bot: Bot, ev: Event):
|
async def send_download_resource_msg(bot: Bot):
|
||||||
await bot.send('正在开始下载~可能需要较久的时间!')
|
await bot.send('正在开始下载~可能需要较久的时间!')
|
||||||
im = await download_all_resource()
|
im = await download_all_resource()
|
||||||
await bot.send(im)
|
await bot.send(im)
|
||||||
@ -19,6 +15,3 @@ async def send_download_resource_msg(bot: Bot, ev: Event):
|
|||||||
async def startup():
|
async def startup():
|
||||||
logger.info('[资源文件下载] 正在检查与下载缺失的资源文件,可能需要较长时间,请稍等')
|
logger.info('[资源文件下载] 正在检查与下载缺失的资源文件,可能需要较长时间,请稍等')
|
||||||
logger.info(f'[资源文件下载] {await download_all_resource()}')
|
logger.info(f'[资源文件下载] {await download_all_resource()}')
|
||||||
|
|
||||||
|
|
||||||
threading.Thread(target=lambda: asyncio.run(startup()), daemon=True).start()
|
|
||||||
|
15
GenshinUID/genshinuid_start/__init__.py
Normal file
15
GenshinUID/genshinuid_start/__init__.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import asyncio
|
||||||
|
import threading
|
||||||
|
|
||||||
|
from ..genshinuid_resource import startup
|
||||||
|
from ..genshinuid_xkdata import draw_xk_abyss_img
|
||||||
|
from ..genshinuid_help.draw_help_card import draw_help_img
|
||||||
|
|
||||||
|
|
||||||
|
async def all_start():
|
||||||
|
await startup()
|
||||||
|
await draw_xk_abyss_img()
|
||||||
|
await draw_help_img()
|
||||||
|
|
||||||
|
|
||||||
|
threading.Thread(target=lambda: asyncio.run(all_start()), daemon=True).start()
|
@ -1,6 +1,5 @@
|
|||||||
import random
|
import random
|
||||||
import asyncio
|
import asyncio
|
||||||
import threading
|
|
||||||
|
|
||||||
from gsuid_core.sv import SV
|
from gsuid_core.sv import SV
|
||||||
from gsuid_core.bot import Bot
|
from gsuid_core.bot import Bot
|
||||||
@ -21,8 +20,3 @@ async def send_abyss_pic(bot: Bot):
|
|||||||
img = await convert_img(TOTAL_IMG)
|
img = await convert_img(TOTAL_IMG)
|
||||||
await bot.logger.info('获得gs帮助图片成功!')
|
await bot.logger.info('获得gs帮助图片成功!')
|
||||||
await bot.send(img)
|
await bot.send(img)
|
||||||
|
|
||||||
|
|
||||||
threading.Thread(
|
|
||||||
target=lambda: asyncio.run(draw_xk_abyss_img()), daemon=True
|
|
||||||
).start()
|
|
||||||
|
@ -131,8 +131,8 @@ class SQLA:
|
|||||||
async def select_cache_cookie(self, uid: str) -> Optional[str]:
|
async def select_cache_cookie(self, uid: str) -> Optional[str]:
|
||||||
sql = select(GsCache).where(GsCache.uid == uid)
|
sql = select(GsCache).where(GsCache.uid == uid)
|
||||||
result = await self.session.execute(sql)
|
result = await self.session.execute(sql)
|
||||||
data: GsCache = result.scalars().one()
|
data: List[GsCache] = result.scalars().all()
|
||||||
return data.cookie if data else None
|
return data[0].cookie if len(data) >= 1 else None
|
||||||
|
|
||||||
async def delete_error_cache(self) -> bool:
|
async def delete_error_cache(self) -> bool:
|
||||||
data = await self.get_all_error_cookie()
|
data = await self.get_all_error_cookie()
|
||||||
@ -353,13 +353,14 @@ class SQLA:
|
|||||||
):
|
):
|
||||||
await self.update_push_data(uid, {f'{mode}_is_push': status})
|
await self.update_push_data(uid, {f'{mode}_is_push': status})
|
||||||
|
|
||||||
async def select_push_data(self, uid: str) -> GsPush:
|
async def select_push_data(self, uid: str) -> Optional[GsPush]:
|
||||||
await self.push_exists(uid)
|
await self.push_exists(uid)
|
||||||
sql = select(GsPush).where(
|
sql = select(GsPush).where(
|
||||||
GsPush.uid == uid and GsPush.bot_id == self.bot_id
|
GsPush.uid == uid and GsPush.bot_id == self.bot_id
|
||||||
)
|
)
|
||||||
result = await self.session.execute(sql)
|
result = await self.session.execute(sql)
|
||||||
return result.scalars().one()
|
data = result.scalars().all()
|
||||||
|
return data[0] if len(data) >= 1 else None
|
||||||
|
|
||||||
async def push_exists(self, uid: str) -> bool:
|
async def push_exists(self, uid: str) -> bool:
|
||||||
sql = select(GsPush).where(
|
sql = select(GsPush).where(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user