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
59 changes: 41 additions & 18 deletions ncatbot/cli/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,7 @@ def init(target_dir: str):
bot_uin = click.prompt("请输入机器人 QQ 号", type=str)
root = click.prompt("请输入管理员 QQ 号", type=str)

config_data = {
"bot_uin": bot_uin,
"root": root,
"debug": False,
"napcat": {
"ws_uri": "ws://localhost:3001",
"ws_token": "napcat_ws",
"webui_uri": "http://localhost:6099",
"webui_token": "napcat_webui",
"enable_webui": True,
},
"plugin": {
"plugins_dir": "plugins",
"load_plugin": True,
"plugin_whitelist": [],
"plugin_blacklist": [],
},
}
config_data = _build_default_config(bot_uin=bot_uin, root=root)

Comment on lines 29 to 33
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.

PR 标题聚焦于“重构 init 命令以使用新的默认配置结构”,但 PR 描述是“fix(dependencies)”且强调版本/依赖更新;两者关注点不一致,后续追溯变更原因会比较困难。建议统一 PR 标题与描述(例如在描述中补充 init 重构内容,或拆分为两个 PR)。

Copilot uses AI. Check for mistakes.
target.mkdir(parents=True, exist_ok=True)
with open(config_path, "w", encoding="utf-8") as f:
Expand All @@ -65,6 +48,46 @@ def init(target_dir: str):
click.echo(info("下一步: 运行 'ncatbot run' 启动机器人"))


def _build_default_config(bot_uin: str, root: str) -> dict:
"""构建 init 命令的默认配置(新 adapters 结构)。"""
return {
"adapters": [
{
"config": {
"enable_webui": True,
"webui_token": "napcat_webui",
"webui_uri": "http://localhost:6099",
"ws_token": "napcat_ws",
"ws_uri": "ws://localhost:3001",
},
"enabled": True,
"platform": "qq",
"type": "napcat",
}
],
"bot_uin": bot_uin,
"check_ncatbot_update": True,
"debug": False,
"enable_webui_interaction": True,
"logging": {
"event_log_levels": {
"meta_event": "NONE",
}
},
"plugin": {
"auto_install_pip_deps": True,
"load_plugin": True,
"plugin_blacklist": [],
"plugin_configs": {},
"plugin_whitelist": [],
"plugins_dir": "plugins",
},
"root": root,
"skip_ncatbot_install_check": False,
"websocket_timeout": 15,
}


def _ensure_plugins_dir(path: Path):
if not path.exists():
path.mkdir(parents=True)
Expand Down
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"
version = "5.2.11.post1"
description = "NcatBot, NapCat Python SDK"
Comment on lines 5 to 8
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.

PR 描述写的是“更新版本号至 5.2.11”,但这里把项目版本改成了 5.2.11.post1;同时 uv.lock 里目前仍是 5.2.11。请确认最终期望版本号,并同步更新 PR 描述与锁文件,避免发布/排查时出现版本歧义。

Copilot uses AI. Check for mistakes.
readme = "README.md"
license = { text = "MIT" }
Expand Down
4 changes: 3 additions & 1 deletion uv.lock

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

Loading