3
0

🐛 Fix signed error

This commit is contained in:
xtaodada 2022-01-28 19:25:58 +08:00
parent bc8118dd20
commit 334d62b8f4
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
3 changed files with 16 additions and 5 deletions

View File

@ -39,6 +39,8 @@ Bot 实例: [@Genshin_All_Info_Bot](https://t.me/Genshin_All_Info_Bot)
## 特别感谢
[genshinstats](https://github.com/thesadru/genshinstats/)
[GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID)
[Genshin_Impact_bot](https://github.com/H-K-Y/Genshin_Impact_bot)

View File

@ -135,7 +135,11 @@ async def OwnerCookies(uid):
async def MysSign(Uid):
try:
gs.set_cookie(await OwnerCookies(Uid))
return gs.claim_daily_reward(Uid, lang='zh-cn')
data = gs.claim_daily_reward(Uid, lang='zh-cn')
if data:
return data
else:
return gs.get_daily_reward_info()
except:
print("签到失败,请重试")

View File

@ -13,6 +13,7 @@ from pyrogram.types import Message
from defs.db2 import MysSign, GetDaily, cacheDB, GetMysInfo, errorDB, GetInfo, GetSpiralAbyssInfo
from defs.event import ys_font
from genshinstats.daily import DailyRewardInfo
WEAPON_PATH = os.path.join("assets", 'weapon')
BG_PATH = os.path.join("assets", "bg")
@ -80,9 +81,13 @@ daily_im = '''
async def sign(uid):
try:
sign_data = await MysSign(uid)
if sign_data is not None:
mes_im = "签到成功"
get_im = f"本次签到获得{sign_data['name']}x{sign_data['cnt']}"
if sign_data:
if isinstance(sign_data, DailyRewardInfo):
mes_im = "已经签到过了!"
get_im = f"本月已经签到了 {sign_data.claimed_rewards}"
else:
mes_im = "签到成功"
get_im = f"本次签到获得{sign_data['name']}x{sign_data['cnt']}"
im = mes_im + "!" + "\n" + get_im
else:
im = "签到失败请检查Cookies是否失效。"
@ -125,7 +130,7 @@ async def daily(mode="push", uid=None):
finished_expedition_num = 0
expedition_info: List[str] = []
for expedition in dailydata['expeditions']:
avatar: str = expedition['icon'][89:-4]
avatar: str = expedition['icon'][92:-4]
try:
avatar_name: str = avatar_json[avatar]
except KeyError: