diff --git a/Paimon_Calendar/__init__.py b/Paimon_Calendar/__init__.py index eb49484..5b9f043 100644 --- a/Paimon_Calendar/__init__.py +++ b/Paimon_Calendar/__init__.py @@ -1,8 +1,7 @@ from nonebot import require, get_bot, on_command, logger -from nonebot.adapters.onebot.v11 import GroupMessageEvent, MessageEvent, Bot, Message, MessageSegment, ActionFailed +from nonebot.adapters.onebot.v11 import MessageEvent, Message from nonebot.params import CommandArg -from utils.config import config from utils.file_handler import load_json, save_json from utils.message_util import MessageBuild, get_message_id from .generate import * diff --git a/Paimon_Info/__init__.py b/Paimon_Info/__init__.py index 622ae87..ce60fc6 100644 --- a/Paimon_Info/__init__.py +++ b/Paimon_Info/__init__.py @@ -6,7 +6,6 @@ from collections import defaultdict from nonebot import on_command, require, logger, get_bot from nonebot.adapters.onebot.v11 import MessageEvent, Message, Bot, MessageSegment -from nonebot.exception import FinishedException from nonebot.params import CommandArg from nonebot.typing import T_State from nonebot.permission import SUPERUSER @@ -385,10 +384,11 @@ cookie_error_msg = '这个cookie无效哦,请旅行者确认是否正确\n1.ck async def ysb_handler(event: MessageEvent, msg: Message = CommandArg()): cookie = str(msg).strip() if cookie == '': - res = '''旅行者好呀,你可以直接用ys/ysa等指令附上uid来使用派蒙\n如果想看全部角色信息和实时便笺等功能,要把cookie给派蒙哦\ncookie - 获取方法:登录网页版米游社,在地址栏粘贴代码:\njavascript:(function(){prompt(document.domain,document.cookie)})( - );\n复制弹窗出来的字符串(手机要via或chrome浏览器才行)\n然后添加派蒙私聊发送ysb接刚刚复制的字符串,例如:ysb - UM_distinctid=17d131d...\ncookie是账号重要安全信息,请确保机器人持有者可信赖! ''' + # res = '''旅行者好呀,你可以直接用ys/ysa等指令附上uid来使用派蒙\n如果想看全部角色信息和实时便笺等功能,要把cookie给派蒙哦\ncookie + # 获取方法:登录网页版米游社,在地址栏粘贴代码:\njavascript:(function(){prompt(document.domain,document.cookie)})( + # );\n复制弹窗出来的字符串(手机要via或chrome浏览器才行)\n然后添加派蒙私聊发送ysb接刚刚复制的字符串,例如:ysb + # UM_distinctid=17d131d...\ncookie是账号重要安全信息,请确保机器人持有者可信赖! ''' + res = '获取cookie的教程在这里哦:\ndocs.qq.com/doc/DQ3JLWk1vQVllZ2Z1\n获取到后,添加派蒙好友私聊发送ysb接复制到的cookie就行啦~' await ysb.finish(res, at_sender=True) else: cookie_info, mys_id = await get_bind_game(cookie) @@ -560,7 +560,7 @@ async def _(event: MessageEvent, state: T_State, msg: Message = CommandArg()): @role_info.got('uid', prompt='请把要查询的uid给派蒙哦~') -# @exception_handler() +@exception_handler() async def _(event: MessageEvent, state: T_State): uid = transform_uid(state['uid']) if uid: diff --git a/README.md b/README.md index 8ff1ade..04f03b2 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,9 @@ + 6.12 - 新增`云原神签到`等功能[@nicklly](https://github.com/nicklly) - 修复部分bug,新增`好友、群新成员和龙王提醒`[#45](https://github.com/CMHopeSunshine/LittlePaimon/issues/45) ++ 6.19 + - 新增`米游币商品兑换`功能,私聊机器人发送`myb`跟着一步步指引来做,目前该功能还没有机会做测试,出现问题请提issue + - `ysb`绑定cookie的方法增加腾讯文档 ## 丨功能列表 diff --git a/utils/enka_util.py b/utils/enka_util.py index 6bcbd23..6c4fd7d 100644 --- a/utils/enka_util.py +++ b/utils/enka_util.py @@ -17,14 +17,9 @@ class PlayerInfo: def __init__(self, uid: str): self.path = Path(__file__).parent.parent / 'user_data' / 'player_info' / f'{uid}.json' self.data = load_json(path=self.path) - if '玩家信息' in self.data: - self.player_info = self.data['玩家信息'] - else: - self.player_info = {} - if '角色' in self.data: - self.roles = self.data['角色'] - else: - self.roles = {} + self.player_info = self.data['玩家信息'] if '玩家信息' in self.data else {} + self.roles = self.data['角色'] if '角色' in self.data else {} + # self.artifacts = self.data['圣遗物'] if '圣遗物' in self.data else transform_artifacts(self.roles) def set_player(self, data: dict): self.player_info['昵称'] = data.get('nickname', 'unknown') @@ -130,6 +125,26 @@ class PlayerInfo: role_info['圣遗物'] = artifacts role_info['更新时间'] = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S') self.roles[role_name] = role_info + # self.set_artifacts(data) + + # def set_artifacts(self, data): + # for artifact in data['equipList'][:-1]: + # artifact_info = {} + # artifact_info['名称'] = artifact_list['Name'][artifact['flat']['icon']] + # artifact_info['图标'] = artifact['flat']['icon'] + # artifact_info['部位'] = artifact_list['Piece'][artifact['flat']['icon'].split('_')[-1]][1] + # artifact_info['所属套装'] = artifact_list['Mapping'][artifact_info['名称']] + # artifact_info['等级'] = artifact['reliquary']['level'] - 1 + # artifact_info['星级'] = artifact['flat']['rankLevel'] + # artifact_info['主属性'] = {'属性名': prop_list[artifact['flat']['reliquaryMainstat']['mainPropId']], + # '属性值': artifact['flat']['reliquaryMainstat']['statValue']} + # artifact_info['词条'] = [] + # for reliquary in artifact['flat']['reliquarySubstats']: + # artifact_info['词条'].append({'属性名': prop_list[reliquary['appendPropId']], + # '属性值': reliquary['statValue']}) + # artifact_info['角色名'] = get_name_by_id(str(data['avatarId'])) + # if artifact_info not in self.artifacts: + # self.artifacts.append(artifact_info) def get_player_info(self): return self.player_info @@ -163,6 +178,27 @@ def dictList_to_list(data): return new_data +# def transform_artifacts(data): +# artifacts = [] +# for role in data.values(): +# for artifact in role['圣遗物']: +# artifacts_temp = {} +# artifacts_temp['名称'] = artifact['名称'] +# artifacts_temp['图标'] = artifact['图标'] +# artifacts_temp['部位'] = artifact['部位'] +# artifacts_temp['所属套装'] = artifact['所属套装'] +# artifacts_temp['等级'] = artifact['等级'] +# artifacts_temp['星级'] = artifact['星级'] +# artifacts_temp['主属性'] = artifact['主属性'] +# artifacts_temp['词条'] = [] +# for reliquary in artifact['词条']: +# artifacts_temp['词条'].append({'属性名': reliquary['属性名'], +# '属性值': reliquary['属性值']}) +# artifacts_temp['角色名'] = role['名称'] +# artifacts.append(artifacts_temp) +# return artifacts + + def artifact_score(role_name, prop_name, prop_value, artifact_type): effective = ra_score['Role'][role_name] score = 0 @@ -214,4 +250,3 @@ def artifact_total_score(data): for i in data: score += i['评分'] return round(score, 1) - diff --git a/utils/json/artifact.json b/utils/json/artifact.json index 8035bbd..5debf6f 100644 --- a/utils/json/artifact.json +++ b/utils/json/artifact.json @@ -2,11 +2,11 @@ "Name": { "UI_RelicIcon_10000_2": "初学者之羽", "UI_RelicIcon_10000_4": "初学者之花", - "UI_RelicIcon_10001_5": "冷却缩减", - "UI_RelicIcon_10001_1": "暴击率", - "UI_RelicIcon_10001_2": "暴击伤害", - "UI_RelicIcon_10001_3": "护盾强效", - "UI_RelicIcon_10001_4": "治疗加成", + "UI_RelicIcon_10001_5": "感别之冠", + "UI_RelicIcon_10001_1": "故人之心", + "UI_RelicIcon_10001_2": "归乡之羽", + "UI_RelicIcon_10001_3": "逐光之石", + "UI_RelicIcon_10001_4": "异国之盏", "UI_RelicIcon_10002_1": "勇士的壮行", "UI_RelicIcon_10002_2": "勇士的期许", "UI_RelicIcon_10002_3": "勇士的冠冕",