mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 11:29:39 +08:00
fix: 公告功能bug
This commit is contained in:
2
main.py
2
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))
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1 @@
|
||||
[
|
||||
{
|
||||
"id": 0,
|
||||
"time": "2023-04-15 16:48:54",
|
||||
"timestamp": 1681548534,
|
||||
"content": "测试公告"
|
||||
}
|
||||
]
|
||||
[]
|
||||
Reference in New Issue
Block a user