nb-cli 脚本/插件简易开发教程 #298
MingxuanGame
started this conversation in
经验
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. 概览
伴随着 nb-cli 1.0 的发布,nb-cli 支持了脚本、插件系统,这允许我们拓展 bot 或 nb-cli 的功能,例如快捷的 bot 管理
nb-cli 1.0 更新了什么
根据 开源之夏 - 暑期 2022(nonebot/nb-cli#35,nonebot/nb-cli#38)以及 Commit 历史,目前更新了如下等功能:
本教程着重讲解
CLI 脚本/插件支持,其他内容请看文档选择
脚本还是插件虽然脚本和插件都可以扩展 nb-cli,但是有以下差异点
注册你的脚本/插件
插件/脚本使用
entry_points机制,将下面内容写进你的pyproject.toml来注册插件/脚本:PEP 621 格式(适用于 setuptools/pdm):
Poetry 格式:
Hello World!
脚本输出:
插件输出:
Footnotes
run_script.jinja->_prepare.py.jinja↩Beta Was this translation helpful? Give feedback.
All reactions