mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-08 04:55:51 +08:00
🚧 支持向核心传递状态
This commit is contained in:
parent
1eb20269cb
commit
8d0c3cb364
@ -1,11 +1,11 @@
|
||||
from PIL import Image
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.help.utils import register_help
|
||||
from gsuid_core.sv import SV, get_plugin_available_prefix
|
||||
|
||||
from .get_help import ICON, get_core_help
|
||||
from .get_help import get_core_help
|
||||
from ..utils.image.image_tools import get_ICON
|
||||
|
||||
PREFIX = get_plugin_available_prefix('GenshinUID')
|
||||
|
||||
@ -19,4 +19,4 @@ async def send_help_img(bot: Bot, ev: Event):
|
||||
await bot.send(im)
|
||||
|
||||
|
||||
register_help('GenshinUID', f'{PREFIX}帮助', Image.open(ICON))
|
||||
register_help('GenshinUID', f'{PREFIX}帮助', get_ICON())
|
||||
|
@ -12,9 +12,8 @@ from gsuid_core.help.draw_new_plugin_help import get_new_help
|
||||
from ..genshinuid_config.gs_config import gsconfig
|
||||
from ..version import Genshin_version, GenshinUID_version
|
||||
from ..utils.fonts.genshin_fonts import genshin_font_origin
|
||||
from ..utils.image.image_tools import get_footer, get_color_bg
|
||||
from ..utils.image.image_tools import get_ICON, get_footer, get_color_bg
|
||||
|
||||
ICON = Path(__file__).parent.parent.parent / 'ICON.png'
|
||||
TEXT_PATH = Path(__file__).parent / 'texture2d'
|
||||
HELP_DATA = Path(__file__).parent / 'help.json'
|
||||
ICON_PATH = Path(__file__).parent / 'icon_path'
|
||||
@ -44,7 +43,7 @@ async def get_core_help() -> Union[bytes, str]:
|
||||
return await get_new_help(
|
||||
plugin_name='GenshinUID',
|
||||
plugin_info={f'v{GenshinUID_version}': ''},
|
||||
plugin_icon=Image.open(ICON),
|
||||
plugin_icon=get_ICON(),
|
||||
plugin_help=await get_help_data(),
|
||||
plugin_prefix=get_plugin_available_prefix('GenshinUID'),
|
||||
help_mode='dark',
|
||||
|
34
GenshinUID/genshinuid_status/__init__.py
Normal file
34
GenshinUID/genshinuid_status/__init__.py
Normal file
@ -0,0 +1,34 @@
|
||||
from gsuid_core.status.plugin_status import register_status
|
||||
from gsuid_core.utils.database.models import GsBind, GsUser
|
||||
|
||||
from ..utils.image.image_tools import get_ICON
|
||||
|
||||
|
||||
async def get_user_num():
|
||||
datas = await GsUser.get_all_stoken()
|
||||
return len(datas)
|
||||
|
||||
|
||||
async def get_add_num():
|
||||
datas = await GsBind.get_all_data()
|
||||
all_uid = []
|
||||
for data in datas:
|
||||
if data.uid:
|
||||
all_uid.extend(data.uid.split('_'))
|
||||
return len(set(all_uid))
|
||||
|
||||
|
||||
async def get_sign_num():
|
||||
datas = await GsUser.get_sign_user_list()
|
||||
return len(datas) if datas else 0
|
||||
|
||||
|
||||
register_status(
|
||||
get_ICON(),
|
||||
'GenshinUID',
|
||||
{
|
||||
'绑定UID': get_add_num,
|
||||
'绑定账户': get_user_num,
|
||||
'开启签到': get_sign_num,
|
||||
},
|
||||
)
|
@ -15,6 +15,7 @@ from ...genshinuid_config.gs_config import gsconfig
|
||||
from ..fonts.genshin_fonts import gs_font_32, gs_font_36
|
||||
from ..resource.RESOURCE_PATH import CHAR_PATH, CU_BG_PATH, TEXT2D_PATH
|
||||
|
||||
ICON = Path(__file__).parent.parent.parent.parent / 'ICON.png'
|
||||
FETTER_PATH = TEXT2D_PATH / 'fetter'
|
||||
TALENT_PATH = TEXT2D_PATH / 'talent'
|
||||
WEAPON_BG_PATH = TEXT2D_PATH / 'weapon'
|
||||
@ -34,6 +35,10 @@ else:
|
||||
bg_path = NM_BG_PATH
|
||||
|
||||
|
||||
def get_ICON():
|
||||
return Image.open(ICON)
|
||||
|
||||
|
||||
def get_v4_bg(w: int, h: int):
|
||||
img = crop_center_img(Image.open(TEXT_PATH / 'bg.jpg'), w, h)
|
||||
black_img = Image.new('RGBA', (w, h), (0, 0, 0, 180))
|
||||
|
Loading…
x
Reference in New Issue
Block a user