修复 bilibili 经验为 0 时 日志报错的 BUG

This commit is contained in:
shitao 2021-01-08 00:28:59 +08:00
parent 3555297ac5
commit 2d8ba5a6f8

View File

@ -329,11 +329,12 @@ class BiliBiliCheckIn(object):
share_av = reward_ret.get("data", {}).get("share_av") share_av = reward_ret.get("data", {}).get("share_av")
today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5 today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5
today_exp += coins_av today_exp += coins_av
update_data = (28800 - new_current_exp) // (today_exp if today_exp else 1)
msg = ( msg = (
f"【Bilibili签到】\n帐号信息: {uname}\n漫画签到: {manhua_msg}\n直播签到: {live_msg}\n" f"【Bilibili签到】\n帐号信息: {uname}\n漫画签到: {manhua_msg}\n直播签到: {live_msg}\n"
f"登陆任务: 今日已登陆\n观看视频: {report_msg}\n分享任务: {share_msg}\n投币任务: {coin_msg}\n" f"登陆任务: 今日已登陆\n观看视频: {report_msg}\n分享任务: {share_msg}\n投币任务: {coin_msg}\n"
f"银瓜子兑换硬币: {silver2coin_msg}\n今日获得经验: {today_exp}\n当前经验: {new_current_exp}\n" f"银瓜子兑换硬币: {silver2coin_msg}\n今日获得经验: {today_exp}\n当前经验: {new_current_exp}\n"
f"按当前速度升级还需: {(28800 - new_current_exp) // today_exp}\n{live_stats}" f"按当前速度升级还需: {update_data}\n{live_stats}"
) )
print(msg) print(msg)
msg_list.append(msg) msg_list.append(msg)