Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 5 additions & 9 deletions ncatbot/app/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def __init__(
adapter: Optional[BaseAdapter] = None,
*,
adapters: Optional[Sequence[BaseAdapter]] = None,
plugin_dir: str = "plugins",
debug: bool = False,
) -> None:
setup_logging(debug=ncatbot_config.debug)

Expand Down Expand Up @@ -80,9 +78,7 @@ def __init__(
self._dispatcher: Optional[AsyncEventDispatcher] = None
self._handler_dispatcher: Optional[HandlerDispatcher] = None
self._service_manager = ServiceManager()
self._plugin_loader = PluginLoader(debug=debug)
self._plugin_dir = Path(plugin_dir)
self._debug = debug
self._plugin_loader = PluginLoader(debug=ncatbot_config.debug)
self._running = False
self._listen_task: Optional[asyncio.Task] = None
self._listen_tasks: List[asyncio.Task] = []
Expand Down Expand Up @@ -348,7 +344,7 @@ def _setup_handler_dispatcher(self) -> None:
async def _setup_services(self) -> None:
"""注册并加载所有内置服务。"""
self._service_manager.set_event_callback(self.dispatcher.callback)
self._service_manager.register_builtin(debug=self._debug)
self._service_manager.register_builtin(debug=ncatbot_config.debug)
await self._service_manager.load_all()

async def _setup_plugins(self) -> None:
Expand All @@ -367,9 +363,9 @@ def _inject_plugin_deps(plugin, manifest):

self._plugin_loader._on_plugin_init = _inject_plugin_deps
await self._plugin_loader.load_builtin_plugins()
await self._plugin_loader.load_all(self._plugin_dir)
await self._plugin_loader.load_all(ncatbot_config.plugin.plugins_dir)

if self._debug and self._service_manager.has("file_watcher"):
if ncatbot_config.debug and self._service_manager.has("file_watcher"):
fw = self._service_manager.file_watcher
fw.add_watch_dir(str(self._plugin_dir.resolve()))
fw.add_watch_dir(ncatbot_config.plugin.plugins_dir)
Comment on lines 364 to +370
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PluginLoader.load_all is annotated to take a Path, but this now passes ncatbot_config.plugin.plugins_dir (a str). It works incidentally because downstream code coerces to Path, but it’s a type mismatch and makes intent unclear. Prefer converting here (e.g., Path(...)) or widen load_all’s parameter type to accept str | Path consistently.

Copilot uses AI. Check for mistakes.
self._plugin_loader.setup_hot_reload(fw)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ncatbot5"
version = "5.2.11.post2"
version = "5.2.11.post3"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyproject.toml sets the project version to 5.2.11.post3, but uv.lock currently records the editable ncatbot5 package as 5.2.11.post1. These should be kept in sync; regenerate the lockfile (or update the lock entry) after bumping the project version to avoid confusing/repro issues for consumers using uv sync.

Suggested change
version = "5.2.11.post3"
version = "5.2.11.post1"

Copilot uses AI. Check for mistakes.
description = "NcatBot, NapCat Python SDK"
readme = "README.md"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading