🐛 修复 abyss 的 bug

修复未绑定 cookie 时, 使用`/abyss`查询具体层数的数据时出现的错误

Signed-off-by: Karako <karakohear@gmail.com>
This commit is contained in:
Karako 2022-10-12 18:15:45 +08:00
parent 59be6fc7a4
commit 94b14773a7
No known key found for this signature in database
GPG Key ID: 5920831B0095D4A0
2 changed files with 8 additions and 6 deletions

View File

@ -207,10 +207,14 @@ class Abyss(Plugin, BasePlugin):
return value return value
abyss_data = await client.get_spiral_abyss(uid, previous=previous, lang="zh-cn") abyss_data = await client.get_spiral_abyss(uid, previous=previous, lang="zh-cn")
if not abyss_data.unlocked: if not abyss_data.unlocked:
raise AbyssUnlocked() raise AbyssUnlocked()
if not abyss_data.ranks.most_kills: if not abyss_data.ranks.most_kills:
raise NoMostKills() raise NoMostKills()
if (total or (floor > 0)) and not abyss_data.floors[0].chambers[0].battles:
raise CookiesNotFoundError
end_time = abyss_data.end_time.astimezone(TZ) end_time = abyss_data.end_time.astimezone(TZ)
time = end_time.strftime("%Y年%m月") + "" if end_time.day <= 16 else "" + "" time = end_time.strftime("%Y年%m月") + "" if end_time.day <= 16 else "" + ""
stars = [i.stars for i in filter(lambda x: x.floor > 8, abyss_data.floors)] stars = [i.stars for i in filter(lambda x: x.floor > 8, abyss_data.floors)]
@ -218,9 +222,7 @@ class Abyss(Plugin, BasePlugin):
render_data = {} render_data = {}
result = await async_re_sub( result = await async_re_sub(
regex_01, regex_01, partial(replace_01, assets_service=self.assets_service), abyss_data.json(encoder=json_encoder)
partial(replace_01, assets_service=self.assets_service),
abyss_data.json(encoder=json_encoder),
) )
result = await async_re_sub(regex_02, partial(replace_02, assets_service=self.assets_service), result) result = await async_re_sub(regex_02, partial(replace_02, assets_service=self.assets_service), result)

View File

@ -51,8 +51,8 @@
<div class="chamber"> <div class="chamber">
<div class="chamber-info"> <div class="chamber-info">
<div> <div>
第 {{ loop.index }} 间 <span 第 {{ chamber.chamber }} 间
style="color: #A3A3A3">{{ chamber.battles[0].timestamp }}</span> <span style="color: #A3A3A3">{{ chamber.battles[0].timestamp }}</span>
</div> </div>
<div class="stars"> <div class="stars">
{% for n in range(chamber.stars) %} {% for n in range(chamber.stars) %}
@ -83,7 +83,7 @@
</div> </div>
{% endfor %} {% endfor %}
{% if loop.length > 1 %} {% if loop.length > 1 %}
<div class="battle-info">{{ ['上', '下'][loop.index0] }}半</div> <div class="battle-info">{{ ['上', '下'][battle.half - 1] }}半</div>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}