From 1c2084216a8471eab7ccd8ad7ae95de82a823b3d Mon Sep 17 00:00:00 2001 From: Bluemangoo Date: Sun, 25 Oct 2026 20:29:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=A5=E6=99=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 11 +++++++++++ lib.py | 1 - sync.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index dc0ffd9..72ca85d 100644 --- a/__init__.py +++ b/__init__.py @@ -27,8 +27,19 @@ def startup(): rlib.set_log_level(logger._core.extra.get("nonebot_log_level", "INFO")) except Exception as e: logger.error(f"设置日志等级失败: {e}") + + +flag = False + + +@driver.on_bot_connect +def _(): + global flag + if flag: + return rlib.boot(str(Path.cwd()), "nonebot_plugin_sekai_update_notify", pconfig.assets_studio_path) scheduler.add_job(sync, "interval", seconds=10, id="sekai_update_sync", replace_existing=True) + flag = True @driver.on_shutdown diff --git a/lib.py b/lib.py index 8e21686..17225e4 100644 --- a/lib.py +++ b/lib.py @@ -62,7 +62,6 @@ class FetchResultUnlinkedCards: ) -# 对应 Rust 中的 FetchResult 枚举 FetchResultType = Union[FetchResultEvent, FetchResultUnlinkedCards] diff --git a/sync.py b/sync.py index eb3c0ab..d9586ae 100644 --- a/sync.py +++ b/sync.py @@ -36,7 +36,7 @@ async def sync(): return for component in data: message = Message() - if component is FetchResultEvent: + if isinstance(component, FetchResultEvent): inner = [MessageSegment.text(f"活动 {component.event_id} 更新了!")] else: inner = [MessageSegment.text("发现了新的非活动卡牌!")]