2022-03-13 21:25:42 +08:00
|
|
|
import json,os,re
|
|
|
|
from hoshino import R,MessageSegment,logger, Service
|
|
|
|
from hoshino.typing import CQEvent, Message
|
2022-04-11 21:18:06 +08:00
|
|
|
from ..util import get_uid_in_msg
|
2022-03-13 21:25:42 +08:00
|
|
|
from ..get_data import get_abyss_data
|
|
|
|
from .get_img import draw_abyss_card
|
|
|
|
|
2022-04-11 21:18:06 +08:00
|
|
|
help_msg='''
|
|
|
|
[sy/深渊查询/深境螺旋查询 (uid) (层数)]查询深渊战绩信息
|
|
|
|
*绑定私人cookie之后才能查看层数具体阵容哦
|
|
|
|
'''
|
|
|
|
sv = Service('派蒙深渊查询', bundle='派蒙', help_=help_msg)
|
2022-03-13 21:25:42 +08:00
|
|
|
|
|
|
|
@sv.on_prefix(('sy','深渊查询','深境螺旋查询'))
|
|
|
|
async def main(bot,ev):
|
2022-04-11 21:18:06 +08:00
|
|
|
uid, msg, user_id, use_cache = await get_uid_in_msg(ev)
|
|
|
|
if not uid:
|
|
|
|
await bot.send(ev,'请把正确的uid给派蒙哦,例如sy100123456!',at_sender=True)
|
|
|
|
return
|
2022-03-13 21:25:42 +08:00
|
|
|
if not msg:
|
2022-04-11 21:18:06 +08:00
|
|
|
floor = []
|
2022-03-13 21:25:42 +08:00
|
|
|
else:
|
2022-04-11 21:18:06 +08:00
|
|
|
floor = msg.split(' ')
|
|
|
|
true_floor = []
|
|
|
|
for f in floor:
|
|
|
|
if f.isdigit() and (9 <= int(f) <=12) and len(true_floor) < 2:
|
|
|
|
true_floor.append(int(f))
|
|
|
|
true_floor.sort()
|
2022-04-12 16:26:08 +08:00
|
|
|
try:
|
|
|
|
data = await get_abyss_data(user_id, uid, use_cache=use_cache)
|
|
|
|
if isinstance(data, str):
|
|
|
|
await bot.send(ev, data, at_sender=True)
|
|
|
|
else:
|
|
|
|
abyss_card = await draw_abyss_card(data, uid, true_floor)
|
|
|
|
await bot.send(ev, abyss_card, at_sender=True)
|
|
|
|
except Exception as e:
|
|
|
|
await bot.send(ev, f'派蒙出现了问题:{e}',at_sender=True)
|
2022-03-13 21:25:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|