diff --git a/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py b/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py index a975543..232a13e 100644 --- a/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py +++ b/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py @@ -9,6 +9,7 @@ BASE_API = 'https://www.youchuang.fun' TEAM_RATE_API = f'{BASE_API}/gamerole/formationRate' VERSION_API = 'https://api-cloudgame-static.mihoyo.com/hk4e_cg_cn/gamer/api/getFunctionShieldNew?client_type=1' +VERSION = 3.1 # 尚未更新3.2深渊 HEADERS = { 'Host': 'www.youchuang.fun', 'Referer': 'https://servicewechat.com/wxce4dbe0cb0f764b3/91/page-frame.html', @@ -18,22 +19,22 @@ HEADERS = { } -async def get_game_version() -> float: - data = await aiorequests.get(VERSION_API) - data = data.json() - return float(data['data']['config']['cg.key_function_queue_news']['versions'][0].replace('.0', '')) +# async def get_game_version() -> float: +# data = await aiorequests.get(VERSION_API) +# data = data.json() +# return float(data['data']['config']['cg.key_function_queue_news']['versions'][0].replace('.0', '')) async def get_team_rate() -> Tuple[TeamRateResult, float]: - version = await get_game_version() + # version = await get_game_version() data_up = (await aiorequests.post(TEAM_RATE_API, json={ - 'version': version, + 'version': VERSION, 'layer': 1 }, headers=HEADERS)).json()['result'] data_down = (await aiorequests.post(TEAM_RATE_API, json={ - 'version': version, + 'version': VERSION, 'layer': 2 }, headers=HEADERS)).json()['result'] return TeamRateResult(rateListUp=parse_obj_as(List[TeamRate], data_up['rateList']), rateListDown=parse_obj_as(List[TeamRate], data_down['rateList']), - userCount=data_up['userCount']), version + userCount=data_up['userCount']), VERSION diff --git a/LittlePaimon/plugins/Paimon_Autobbs/coin_handle.py b/LittlePaimon/plugins/Paimon_Autobbs/coin_handle.py index d03141c..25debe1 100644 --- a/LittlePaimon/plugins/Paimon_Autobbs/coin_handle.py +++ b/LittlePaimon/plugins/Paimon_Autobbs/coin_handle.py @@ -204,7 +204,7 @@ class MihoyoBBSCoin: if data['retcode'] != 1034: self.is_valid = False self.state = 'Cookie已失效' if data['retcode'] in [-100, - 10001] else f"出错了:{data['retcode']} {data['message']}" + 10001] else f"出错了:{data['retcode']} {data['message']}" if data['retcode'] != 1034 else '疑似遇到验证码' logger.info('米游币自动获取', f'➤➤{self.state}') return f'讨论区签到:{self.state}' await asyncio.sleep(random.randint(15, 30)) diff --git a/LittlePaimon/plugins/Paimon_DailyNote/handler.py b/LittlePaimon/plugins/Paimon_DailyNote/handler.py index d68c7d6..7cd55eb 100644 --- a/LittlePaimon/plugins/Paimon_DailyNote/handler.py +++ b/LittlePaimon/plugins/Paimon_DailyNote/handler.py @@ -50,6 +50,10 @@ async def handle_ssbq(player: Player): if isinstance(data, str): logger.info('原神实时便签', '➤', {'用户': player.user_id, 'UID': player.uid}, f'获取数据失败, {data}', False) return f'{player.uid}{data}\n' + elif data['retcode'] == 1034: + logger.info('原神实时便签', '➤', {'用户': player.user_id, 'UID': player.uid}, + '获取数据失败,状态码为1034,疑似验证码', False) + return f'{player.uid}获取数据失败,疑似遇米游社验证码阻拦,请稍后再试\n' elif data['retcode'] != 0: logger.info('原神实时便签', '➤', {'用户': player.user_id, 'UID': player.uid}, f'获取数据失败,code为{data["retcode"]}, msg为{data["message"]}', False) diff --git a/LittlePaimon/plugins/Paimon_Info/draw_character_bag.py b/LittlePaimon/plugins/Paimon_Info/draw_character_bag.py index d8437b7..bbf9225 100644 --- a/LittlePaimon/plugins/Paimon_Info/draw_character_bag.py +++ b/LittlePaimon/plugins/Paimon_Info/draw_character_bag.py @@ -188,7 +188,7 @@ async def draw_chara_bag(player: Player, info: PlayerInfo, characters: List[Char # 签名和uid if info.signature: await img.text(info.signature, 165, 116, fm.get('hywh', 32), '#252525') - nickname_length = img.text_length(info.nickname, fm.get('hywh', 40)) + nickname_length = img.text_length(info.nickname, fm.get('hywh', 48)) await img.text(f'UID{player.uid}', 166 + nickname_length + 36, 58, fm.get('bahnschrift_regular', 48, 'Regular'), '#252525') else: diff --git a/LittlePaimon/utils/genshin.py b/LittlePaimon/utils/genshin.py index e721138..0135459 100644 --- a/LittlePaimon/utils/genshin.py +++ b/LittlePaimon/utils/genshin.py @@ -115,6 +115,9 @@ class GenshinInfoManager: data = await get_mihoyo_public_data(self.uid, self.user_id, 'player_card') if not isinstance(data, dict): return data + elif data['retcode'] == 1034: + logger.info('原神信息', f'更新{self.uid}的玩家数据时出错,状态码为1034,疑似验证码') + return '疑似遇米游社验证码阻拦,请稍后再试' elif data['retcode'] != 0: logger.info('原神信息', f'更新{self.uid}的玩家数据时出错,消息为{data["message"]}') return data['message']