From b9e6b07edadb1bc3d5dfac2061e539afc9fb89e3 Mon Sep 17 00:00:00 2001
From: CMHopeSunshine <277073121@qq.com>
Date: Fri, 4 Nov 2022 22:36:07 +0800
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D`=E6=B7=B1?=
=?UTF-8?q?=E6=B8=8A=E9=85=8D=E9=98=9F`=E6=8A=A5=E9=94=99=EF=BC=8C?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E9=81=87=E5=88=B0=E9=AA=8C=E8=AF=81=E7=A0=81?=
=?UTF-8?q?=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../plugins/Paimon_Abyss/youchuang/api.py | 17 +++++++++--------
.../plugins/Paimon_Autobbs/coin_handle.py | 2 +-
.../plugins/Paimon_DailyNote/handler.py | 4 ++++
.../plugins/Paimon_Info/draw_character_bag.py | 2 +-
LittlePaimon/utils/genshin.py | 3 +++
5 files changed, 18 insertions(+), 10 deletions(-)
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']