更新2.7深渊登场率

This commit is contained in:
CMHopeSunshine 2022-06-05 01:03:43 +08:00
parent 8067de559f
commit adfd601fd7
4 changed files with 25 additions and 19 deletions

View File

@ -146,7 +146,7 @@ async def _(event: MessageEvent, state: T_State):
else:
abyss_card = await draw_abyss_card(data, uid, true_floor)
total_result += abyss_card
await sy.finish(total_result, at_sender=True)
await sy.finish(total_result)
@ssbq.handle()
@ -182,7 +182,7 @@ async def ssbq_handler(event: MessageEvent, msg: Message = CommandArg()):
await ssbq.finish(data, at_sender=True)
else:
daily_note_card = await draw_daily_note_card(data, uid)
await ssbq.finish(daily_note_card, at_sender=True)
await ssbq.finish(daily_note_card)
@myzj.handle()
@ -205,7 +205,7 @@ async def myzj_handler(event: MessageEvent, msg: Message = CommandArg()):
await myzj.finish(data, at_sender=True)
else:
monthinfo_card = await draw_monthinfo_card(data)
await myzj.finish(monthinfo_card, at_sender=True)
await myzj.finish(monthinfo_card)
@ys.got('uid', prompt='请把要查询的uid给派蒙哦~')
@ -232,7 +232,7 @@ async def ys_handler(bot: Bot, event: MessageEvent, state: T_State):
chara_data = None if isinstance(chara_data, str) else chara_data
player_card = await draw_player_card(data, chara_data, uid, nickname)
total_result += player_card
await ys.finish(total_result, at_sender=True)
await ys.finish(total_result)
@ysa.got('uid', prompt='请把要查询的uid给派蒙哦~')
@ -252,7 +252,7 @@ async def ysa_handler(event: MessageEvent, state: T_State):
else:
player_card = await draw_all_chara_card(chara_data, uid)
total_result += player_card
await ysa.finish(total_result, at_sender=True)
await ysa.finish(total_result)
@ysc.got('uid', prompt='请把要查询的uid给派蒙哦~')
@ -319,7 +319,7 @@ async def _(event: MessageEvent, state: T_State):
skill_data = await get_chara_skill_data(uid, role[1], use_cache=state['use_cache'])
chara_card = await draw_chara_card(chara_data, skill_data, role, uid)
total_result += chara_card
await ysc.finish(total_result, at_sender=True)
await ysc.finish(total_result)
cookie_error_msg = '这个cookie无效哦请旅行者确认是否正确\n1.ck要登录mys帐号后获取,且不能退出登录\n2.ck中要有cookie_token和account_id两个参数\n3.建议在无痕模式下取'
@ -428,7 +428,7 @@ async def mys_sign_auto_handler(event: MessageEvent, msg: Message = CommandArg()
ud_lmt = FreqLimiter(300)
ud_p_lmt = FreqLimiter(10)
ud_p_lmt = FreqLimiter(12)
@update_info.handle()
@ -530,7 +530,7 @@ async def sign_all():
@update_all.handle()
async def update_all():
async def _():
res = await all_update()
await update_all.finish(res)
@ -656,4 +656,4 @@ async def all_update():
failed_time += 1
if failed_time > 5:
break
return '{}用户,更新完成'.format(len(uid_list))
return '玩家信息uid更新{},更新完成'.format(len(uid_list))

View File

@ -4,6 +4,7 @@ from utils.decorator import cache
from utils import aiorequests
import datetime
import re
from asyncio import sleep
@cache(ttl=datetime.timedelta(minutes=10))
@ -226,8 +227,13 @@ async def get_sign_list():
async def get_enka_data(uid):
url = f'https://enka.shinshin.moe/u/{uid}/__data.json'
resp = await aiorequests.get(url=url)
data = resp.json()
return data
for _ in range(3):
try:
url = f'https://enka.shinshin.moe/u/{uid}/__data.json'
resp = await aiorequests.get(url=url)
data = resp.json()
return data
except Exception:
await sleep(1.5)

View File

@ -13,7 +13,7 @@ headers = {
async def get_rate(type: str = 'role'):
url = f'https://www.youchuang.fun/gamerole/{type}Rate'
json_data = {
"version": "2.6"
"version": "2.7"
}
res = await aiorequests.post(url=url, headers=headers, json=json_data)
return res.json()
@ -22,7 +22,7 @@ async def get_rate(type: str = 'role'):
async def get_formation_rate(layer: int = 1):
url = 'https://www.youchuang.fun/gamerole/formationRate'
json_data = {
"version": "2.6",
"version": "2.7",
"layer": layer
}
res = await aiorequests.post(url=url, headers=headers, json=json_data)
@ -33,7 +33,7 @@ async def get_teammates_rate(name: str):
url = 'https://www.youchuang.fun/gamerole/teammatesRate'
json_data = {
"name": name,
"version": "2.6"
"version": "2.7"
}
res = await aiorequests.post(url=url, headers=headers, json=json_data)
return res.json()
@ -43,7 +43,7 @@ async def get_weapon_rate(name: str):
url = 'https://www.youchuang.fun/gamerole/getWeaponByName'
json_data = {
"name": name,
"version": "2.6"
"version": "2.7"
}
res = await aiorequests.post(url=url, headers=headers, json=json_data)
return res.json()

View File

@ -24,7 +24,7 @@ async def draw_rate_rank(type: str = 'role', mode: str = 'used'):
bg_img = Image.new('RGBA', (1080, top_img.height + col * 220 + bottom_img.height + 50))
bg_img.paste(top_img, (0, 0))
bg_draw = ImageDraw.Draw(bg_img)
bg_draw.text((70, 55), '2.6深境螺旋登场率排行榜', fill='black', font=get_font(40, 'msyhbd.ttc'))
bg_draw.text((70, 55), '2.7深境螺旋登场率排行榜', fill='black', font=get_font(40, 'msyhbd.ttc'))
bg_draw.text((70, 110), f'当前共{data["result"]["userCount"]}份样本数据', fill='black', font=get_font(35))
for i in range(0, col + 1):
bg_img.paste(body_img, (0, top_img.height + i * body_img.height))
@ -52,7 +52,7 @@ async def draw_teams_rate(floor='上半半'):
bg_img = Image.new('RGBA', (1080, top_img.height + 10 * body_img.height + bottom_img.height - 130))
bg_img.paste(top_img, (0, 0))
bg_draw = ImageDraw.Draw(bg_img)
bg_draw.text((70, 55), f'2.6深境螺旋阵容出场率 | {floor}', fill='black', font=get_font(40, 'msyhbd.ttc'))
bg_draw.text((70, 55), f'2.7深境螺旋阵容出场率 | {floor}', fill='black', font=get_font(40, 'msyhbd.ttc'))
bg_draw.text((70, 110), f'当前共{data["result"]["userCount"]}份样本数据', fill='black', font=get_font(35))
for i in range(0, 10):
bg_img.paste(body_img, (0, top_img.height + i * body_img.height))