refactor: 恢复所有审计API调用

This commit is contained in:
RockChinQ
2024-01-31 00:02:19 +08:00
parent c1c751a9ab
commit 32162afa65
11 changed files with 172 additions and 48 deletions

View File

@@ -104,3 +104,20 @@ class AnnouncementManager:
await self.write_saved(all)
return to_show
async def show_announcements(
self
):
"""显示公告"""
try:
announcements = await self.fetch_new()
for ann in announcements:
self.ap.logger.info(f'[公告] {ann.time}: {ann.content}')
if announcements:
await self.ap.ctr_mgr.main.post_announcement_showed(
ids=[item.id for item in announcements]
)
except Exception as e:
self.ap.logger.warning(f'获取公告时出错: {e}')

View File

@@ -148,7 +148,7 @@ class VersionManager:
with open("current_tag", "w") as f:
f.write(current_tag)
self.ap.ctr_mgr.main.post_update_record(
await self.ap.ctr_mgr.main.post_update_record(
spent_seconds=int(time.time()-start_time),
infer_reason="update",
old_version=old_tag,
@@ -224,3 +224,13 @@ class VersionManager:
return 0
async def show_version_update(
self
):
try:
if await self.ap.ver_mgr.is_new_version_available():
self.ap.logger.info("有新版本可用,请使用 !update 命令更新")
except Exception as e:
self.ap.logger.warning(f"检查版本更新时出错: {e}")