support ledger month info in stats

This commit is contained in:
xtaodada 2024-05-08 23:42:46 +08:00
parent 868de0798b
commit 0f1cb5ec69
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,10 @@ class PlayerStatsPlugins(Plugin):
rogue = await client.get_starrail_rogue(uid)
except SimnetBadRequest:
rogue = None
try:
ledger = await client.get_starrail_ledger_month_info(uid)
except SimnetBadRequest:
ledger = None
logger.debug(user_info)
await self.set_name_card(uid, user_info.phone_background_image_url)
data = {
@ -113,6 +117,13 @@ class PlayerStatsPlugins(Plugin):
("已解锁奇物", "unlocked_miracle_num"),
("已解锁祝福", "unlocked_buff_num"),
],
"ledger": ledger,
"ledger_labels": [
("本月星琼", "current_hcoin"),
("本月通专票", "current_rails_pass"),
("上月星琼", "last_hcoin"),
("上月通专票", "last_rails_pass"),
],
"style": "xianzhou", # nosec
"avatar": (await self.head_icon.get_head_icon(uid)).as_uri(),
"background": (await self.phone_theme.get_phone_theme(uid)).as_uri(),

View File

@ -54,6 +54,14 @@
</div>
{% endfor %}
{% endif %}
{% if ledger %}
{% for label, key in ledger_labels %}
<div class="">
<div class="text-xl box-stats">{{ ledger[key] }}</div>
<div class="text-neutral-400 box-stats-label">{{ label }}</div>
</div>
{% endfor %}
{% endif %}
</div>
<div class="about text-center leading-8 text-xs opacity-50">