Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ncatbot/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@
)

# Session 便利类型(从 plugin 层 re-export,方便用户导入)
from ncatbot.plugin import SessionCancelled, SessionResult
# 延迟到 __getattr__ 惰性导入,打破 plugin ↔ core 初始化时的循环导入
def __getattr__(name: str):
if name in ("SessionCancelled", "SessionResult"):
from ncatbot.plugin import SessionCancelled, SessionResult
return SessionCancelled if name == "SessionCancelled" else SessionResult
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

__all__ = [
"AsyncEventDispatcher",
Expand Down