diff --git a/main.py b/main.py index 41a27d77..aa997148 100644 --- a/main.py +++ b/main.py @@ -305,7 +305,7 @@ def start(first_time_init=False): new_announcement = announcement.fetch_new() if len(new_announcement) > 0: for announcement in new_announcement: - logging.critical("[公告] {}".format(announcement)) + logging.critical("[公告]<{}> {}".format(announcement['time'], announcement['content'])) except Exception as e: logging.warning("获取公告失败:{}".format(e)) diff --git a/pkg/utils/announcement.py b/pkg/utils/announcement.py index 57e23184..4bff412d 100644 --- a/pkg/utils/announcement.py +++ b/pkg/utils/announcement.py @@ -33,7 +33,7 @@ def read_saved() -> list: def write_saved(content: list): # 已保存的在res/announcement_saved - with open("res/announcement_saved", "w", encoding="utf-8") as f: + with open("res/announcement_saved.json", "w", encoding="utf-8") as f: f.write(json.dumps(content, indent=4, ensure_ascii=False)) diff --git a/res/announcement.json b/res/announcement.json index 1b05e4b6..0637a088 100644 --- a/res/announcement.json +++ b/res/announcement.json @@ -1,8 +1 @@ -[ - { - "id": 0, - "time": "2023-04-15 16:48:54", - "timestamp": 1681548534, - "content": "测试公告" - } -] \ No newline at end of file +[] \ No newline at end of file