diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 907630c9..2b54eae1 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -44,7 +44,8 @@ pip install nonebot2[scheduler] poetry add nonebot2[scheduler] ``` -[View On GitHub](https://github.com/agronholm/apscheduler) +[![apscheduler](https://img.shields.io/github/stars/agronholm/apscheduler?style=social)](https://github.com/agronholm/apscheduler) + ### NoneBot-Test @@ -57,7 +58,7 @@ pip install nonebot2[test] poetry add nonebot2[test] ``` -[View On GitHub](https://github.com/nonebot/nonebot-test) +[![nonebot-test](https://img.shields.io/github/stars/nonebot/nonebot-test?style=social)](https://github.com/nonebot/nonebot-test) ### CLI @@ -70,7 +71,7 @@ pip install nonebot2[cli] poetry add nonebot2[cli] ``` -[View On GitHub](https://github.com/yanyongyu/nb-cli) +[![nb-cli](https://img.shields.io/github/stars/nonebot/nb-cli?style=social)](https://github.com/yanyongyu/nb-cli) ### 我全都要 diff --git a/docs/guide/loading-a-plugin.md b/docs/guide/loading-a-plugin.md index b648b4b6..2a3016d5 100644 --- a/docs/guide/loading-a-plugin.md +++ b/docs/guide/loading-a-plugin.md @@ -52,12 +52,7 @@ if __name__ == "__main__": ::: :::danger 警告 -插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以使用如下两种方法: - -1. (推荐) `from plugin_name import xxx` 而非 `from awesome_bot.plugins.plugin_name import xxx` -2. 在需要导入其他插件的文件中添加 `__package__ = "plugins"; from .plugin_name import xxx` (将共同的上层目录设定为父包后使用相对导入) - -具体可以参考:[nonebot/nonebot2#32](https://github.com/nonebot/nonebot2/issues/32) +插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以参考 [进阶-跨插件访问](../advanced/export-and-require.md) ::: ## 加载单个插件 @@ -113,10 +108,6 @@ _sub_plugins |= nonebot.load_plugins( 插件将会被加载并存储于 `_sub_plugins` 中。 -:::tip 提示 -如果在父插件中需要定义事件响应器,应在**子插件被加载后**进行定义 -::: - ## 运行结果 尝试运行 `nb run` 或者 `python bot.py`,可以看到日志输出了类似如下内容: