mirror of
https://github.com/baiqwerdvd/ArknightsUID.git
synced 2025-05-05 03:23:45 +08:00
update
This commit is contained in:
parent
2cfe45d2cf
commit
0f99c7ff47
@ -122,7 +122,7 @@ async def check_ark_ann():
|
|||||||
img = await get_ann_img(data)
|
img = await get_ann_img(data)
|
||||||
title = data.title.replace("\\n", "")
|
title = data.title.replace("\\n", "")
|
||||||
msg = [
|
msg = [
|
||||||
MessageSegment.text(f"[明日方舟公告] {title}\n"),
|
MessageSegment.text(f"[明日方舟公告更新] {title}\n"),
|
||||||
MessageSegment.image(img),
|
MessageSegment.image(img),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3,11 +3,12 @@ from pathlib import Path
|
|||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from gsuid_core.data_store import get_res_path
|
|
||||||
from gsuid_core.logger import logger
|
|
||||||
from msgspec import convert
|
from msgspec import convert
|
||||||
from msgspec import json as msgjson
|
from msgspec import json as msgjson
|
||||||
|
|
||||||
|
from gsuid_core.data_store import get_res_path
|
||||||
|
from gsuid_core.logger import logger
|
||||||
|
|
||||||
from .model import (
|
from .model import (
|
||||||
BulletinData,
|
BulletinData,
|
||||||
BulletinMeta,
|
BulletinMeta,
|
||||||
@ -73,15 +74,20 @@ async def check_bulletin_update() -> dict[str, BulletinData]:
|
|||||||
if cur_meta.get("code") == 0:
|
if cur_meta.get("code") == 0:
|
||||||
match target:
|
match target:
|
||||||
case "Android":
|
case "Android":
|
||||||
android_data = convert(cur_meta.get("data", {}), BulletinTargetData)
|
android_data = convert(
|
||||||
|
cur_meta.get("data", {}), BulletinTargetData
|
||||||
|
)
|
||||||
bulletin_meta.target.Android = android_data
|
bulletin_meta.target.Android = android_data
|
||||||
case "Bilibili":
|
case "Bilibili":
|
||||||
bilibili_data = convert(cur_meta.get("data", {}), BulletinTargetData)
|
bilibili_data = convert(
|
||||||
|
cur_meta.get("data", {}), BulletinTargetData
|
||||||
|
)
|
||||||
bulletin_meta.target.Bilibili = bilibili_data
|
bulletin_meta.target.Bilibili = bilibili_data
|
||||||
case "IOS":
|
case "IOS":
|
||||||
ios_data = convert(cur_meta.get("data", {}), BulletinTargetData)
|
ios_data = convert(
|
||||||
|
cur_meta.get("data", {}), BulletinTargetData
|
||||||
|
)
|
||||||
bulletin_meta.target.IOS = ios_data
|
bulletin_meta.target.IOS = ios_data
|
||||||
logger.info("The file 'bulletin.meta.json' has been successfully updated.")
|
|
||||||
|
|
||||||
assert android_data is not None
|
assert android_data is not None
|
||||||
assert bilibili_data is not None
|
assert bilibili_data is not None
|
||||||
@ -123,13 +129,16 @@ async def check_bulletin_update() -> dict[str, BulletinData]:
|
|||||||
new_ann[item.cid] = ann
|
new_ann[item.cid] = ann
|
||||||
logger.info(f"New bulletin found: {item.cid}:{item.title}")
|
logger.info(f"New bulletin found: {item.cid}:{item.title}")
|
||||||
|
|
||||||
bulletin_meta.data = dict(sorted(bulletin_meta.data.items(), key=lambda x: int(x[0])))
|
bulletin_meta.data = dict(
|
||||||
|
sorted(bulletin_meta.data.items(), key=lambda x: int(x[0]))
|
||||||
|
)
|
||||||
bulletin_meta.update = dict(
|
bulletin_meta.update = dict(
|
||||||
sorted(bulletin_meta.update.items(), key=lambda x: x[1].cid, reverse=False)
|
sorted(bulletin_meta.update.items(), key=lambda x: x[1].cid, reverse=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
data = msgjson.decode(msgjson.encode(bulletin_meta))
|
data = msgjson.decode(msgjson.encode(bulletin_meta))
|
||||||
write_json(data, bulletin_path)
|
write_json(data, bulletin_path)
|
||||||
|
logger.info("The file 'bulletin.meta.json' has been successfully updated.")
|
||||||
|
|
||||||
if is_first:
|
if is_first:
|
||||||
logger.info("Initial success, will be updated in the next polling.")
|
logger.info("Initial success, will be updated in the next polling.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user