2020-10-16 15:59:34 +08:00
|
|
|
|
<p align="center">
|
|
|
|
|
<a href="https://v2.nonebot.dev/"><img src="https://raw.githubusercontent.com/nonebot/nonebot2/master/docs/.vuepress/public/logo.png" width="200" height="200" alt="nonebot"></a>
|
|
|
|
|
</p>
|
|
|
|
|
|
2020-10-16 16:07:04 +08:00
|
|
|
|
<div align="center">
|
2020-10-16 16:08:51 +08:00
|
|
|
|
|
|
|
|
|
# NoneBot
|
|
|
|
|
|
|
|
|
|
_✨ Python 异步机器人框架 ✨_
|
|
|
|
|
|
2020-10-16 16:07:04 +08:00
|
|
|
|
</div>
|
2020-08-11 17:02:29 +08:00
|
|
|
|
|
2020-10-16 15:59:34 +08:00
|
|
|
|
<p align="center">
|
|
|
|
|
<a href="https://raw.githubusercontent.com/nonebot/nonebot2/master/LICENSE">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/github/license/nonebot/nonebot2" alt="license">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
|
|
|
|
<a href="https://pypi.python.org/pypi/nonebot2">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/pypi/v/nonebot2" alt="pypi">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/python-3.7+-blue" alt="python"><br />
|
|
|
|
|
<a href="https://github.com/howmanybots/onebot/blob/master/README.md">
|
|
|
|
|
<img src="https://img.shields.io/badge/OneBot-v11-black?style=social&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAIVBMVEUAAAAAAAADAwMHBwceHh4UFBQNDQ0ZGRkoKCgvLy8iIiLWSdWYAAAAAXRSTlMAQObYZgAAAQVJREFUSMftlM0RgjAQhV+0ATYK6i1Xb+iMd0qgBEqgBEuwBOxU2QDKsjvojQPvkJ/ZL5sXkgWrFirK4MibYUdE3OR2nEpuKz1/q8CdNxNQgthZCXYVLjyoDQftaKuniHHWRnPh2GCUetR2/9HsMAXyUT4/3UHwtQT2AggSCGKeSAsFnxBIOuAggdh3AKTL7pDuCyABcMb0aQP7aM4AnAbc/wHwA5D2wDHTTe56gIIOUA/4YYV2e1sg713PXdZJAuncdZMAGkAukU9OAn40O849+0ornPwT93rphWF0mgAbauUrEOthlX8Zu7P5A6kZyKCJy75hhw1Mgr9RAUvX7A3csGqZegEdniCx30c3agAAAABJRU5ErkJggg==" alt="cqhttp">
|
|
|
|
|
</a>
|
2021-02-02 13:17:29 +08:00
|
|
|
|
<a href="http://github.com/mamoe/mirai">
|
|
|
|
|
<img src="https://img.shields.io/badge/mirai-HTTP-lightgrey?style=social">
|
|
|
|
|
</a>
|
2020-12-29 12:12:35 +08:00
|
|
|
|
<a href="https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/%E9%92%89%E9%92%89-Bot-lightgrey?style=social&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAnFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4jUzeAAAAM3RSTlMAQKSRaA+/f0YyFevh29R3cyklIfrlyrGsn41tVUs48c/HqJm9uZdhX1otGwkF9IN8V1CX0Q+IAAABY0lEQVRYw+3V2W7CMBAF0JuNQAhhX9OEfYdu9///rUVWpagE27Ef2gfO+0zGozsKnv6bMGzAhkNytIe5gDdzrwtTCwrbI8x4/NF668NAxgI3Q3UtFi3TyPwNQtPLUUmDd8YfqGLNe4v22XwEYb5zoOuF5baHq2UHtsKe5ivWfGAwrWu2mC34QM0PoCAuqZdOmiwV+5BLyMRtZ7dTSEcs48rzWfzwptMLyzpApka1SJ5FtR4kfCqNIBPEVDmqoqgwUYY5plQOlf6UEjNoOPnuKB6wzDyCrks///TDza8+PnR109WQdxLo8RKWq0PPnuXG0OXKQ6wWLFnCg75uYYbhmMIVVdQ709q33aHbGIj6Duz+2k1HQFX9VwqmY8xYsEJll2ahvhWgsjYLHFRXvIi2Qb0jzMQCzC3FAoydxCma88UCzE3JCWwkjCNYyMUCzHX4DiuTMawEwwhW6hnshPhjZzzJfAH0YacpbmRd7QAAAABJRU5ErkJggg==" alt="ding">
|
|
|
|
|
</a>
|
|
|
|
|
<a href="https://core.telegram.org/bots/api">
|
|
|
|
|
<img src="https://img.shields.io/badge/telegram-Bot-lightgrey?style=social&logo=telegram">
|
|
|
|
|
</a>
|
|
|
|
|
<br />
|
2020-10-16 15:59:34 +08:00
|
|
|
|
<a href="https://jq.qq.com/?_wv=1027&k=5OFifDh">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/qq%E7%BE%A4-768887710-orange?style=flat-square" alt="QQ Chat">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
|
|
|
|
<a href="https://t.me/cqhttp">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/telegram-chat-blue?style=flat-square" alt="Telegram Chat">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
|
|
|
|
<a href="https://jq.qq.com/?_wv=1027&k=5Nl0zhE">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E7%BE%A4-218529254-green?style=flat-square" alt="QQ Release">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
|
|
|
|
<a href="https://t.me/cqhttp_release">
|
2020-12-22 00:41:33 +08:00
|
|
|
|
<img src="https://img.shields.io/badge/%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E9%A2%91%E9%81%93-join-green?style=flat-square" alt="Telegram Release">
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p align="center">
|
|
|
|
|
<a href="https://v2.nonebot.dev/">文档</a>
|
|
|
|
|
·
|
|
|
|
|
<a href="https://v2.nonebot.dev/guide/installation.html">安装</a>
|
|
|
|
|
·
|
|
|
|
|
<a href="https://v2.nonebot.dev/guide/getting-started.html">开始使用</a>
|
2020-12-01 00:56:19 +08:00
|
|
|
|
·
|
|
|
|
|
<a href="#插件">文档打不开?</a>
|
2020-10-16 15:59:34 +08:00
|
|
|
|
</p>
|
|
|
|
|
|
2018-08-26 13:44:54 +08:00
|
|
|
|
## 简介
|
2018-07-01 20:37:48 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人收到的事件进行解析和处理,并以插件化的形式,按优先级分发给事件所对应的事件响应器,来完成具体的功能。
|
|
|
|
|
|
|
|
|
|
除了起到解析事件的作用,NoneBot 还为插件提供了大量实用的预设操作和权限控制机制。对于命令处理,它更是提供了完善且易用的会话机制和内部调用机制,以分别适应命令的连续交互和插件内部功能复用等需求。
|
|
|
|
|
|
|
|
|
|
得益于 Python 的 [asyncio](https://docs.python.org/3/library/asyncio.html) 机制,NoneBot 处理事件的吞吐量有了很大的保障,再配合 WebSocket 通信方式(也是最建议的通信方式),NoneBot 的性能可以达到 HTTP 通信方式的两倍以上,相较于传统同步 I/O 的 HTTP 通信,更是有质的飞跃。
|
|
|
|
|
|
|
|
|
|
## 特色
|
|
|
|
|
|
|
|
|
|
NoneBot2 的驱动框架 `Driver` 以及通信协议 `Adapter` 均可**自定义**,并且可以作为插件进行**替换/添加**!
|
|
|
|
|
|
|
|
|
|
目前 NoneBot2 内置的驱动框架:
|
|
|
|
|
|
|
|
|
|
- [FastAPI](https://fastapi.tiangolo.com/)
|
|
|
|
|
|
|
|
|
|
目前 NoneBot2 内置的协议适配:
|
|
|
|
|
|
2020-12-22 09:59:48 +08:00
|
|
|
|
- [OneBot(CQHTTP) 协议](https://github.com/howmanybots/onebot/blob/master/README.md) (QQ 等)
|
2021-02-02 13:17:29 +08:00
|
|
|
|
- [Mirai-API-HTTP 协议](https://github.com/project-mirai/mirai-api-http)
|
2020-12-29 12:12:35 +08:00
|
|
|
|
- [钉钉](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p) _开发中_
|
2020-12-01 00:56:19 +08:00
|
|
|
|
- [Telegram](https://core.telegram.org/bots/api) _计划中_
|
|
|
|
|
|
|
|
|
|
## 即刻开始
|
|
|
|
|
|
|
|
|
|
~~完整~~文档可以在 [这里](https://v2.nonebot.dev/) 查看。
|
|
|
|
|
|
|
|
|
|
懒得看文档?下面是快速安装指南:~~这是坏文明~~
|
|
|
|
|
|
|
|
|
|
1. (可选)使用你喜欢的 Python 环境管理工具创建新的虚拟环境。
|
|
|
|
|
2. 使用 `pip` (或其他) 安装 NoneBot 脚手架。
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
```bash
|
|
|
|
|
pip install nb-cli
|
|
|
|
|
```
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
3. 使用脚手架创建项目
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
```bash
|
|
|
|
|
nb create
|
|
|
|
|
```
|
2018-12-19 18:23:27 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
## 插件
|
2018-12-19 18:23:27 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
此外,NoneBot2 还有丰富的官方以及第三方现成的插件供大家使用:
|
2020-10-16 15:59:34 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
- [NoneBot-Plugin-Docs](https://github.com/nonebot/nonebot2/tree/master/packages/nonebot-plugin-docs):离线文档至本地使用(别再说文档打不开了!)
|
2020-10-16 15:59:34 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
```bash
|
|
|
|
|
nb plugin install nonebot_plugin_docs
|
|
|
|
|
```
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
2020-12-01 00:56:19 +08:00
|
|
|
|
- 其他插件请查看 [插件商店](https://v2.nonebot.dev/plugin-store.html)
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
|
|
|
|
## 贡献
|
|
|
|
|
|
2020-09-17 18:40:21 +08:00
|
|
|
|
如果你在使用过程中发现任何问题,可以 [提交 issue](https://github.com/nonebot/nonebot2/issues/new) 或自行 fork 修改后提交 pull request。
|
2018-08-26 13:44:54 +08:00
|
|
|
|
|
|
|
|
|
如果你要提交 pull request,请确保你的代码风格和项目已有的代码保持一致,遵循 [PEP 8](https://www.python.org/dev/peps/pep-0008/),变量命名清晰,有适当的注释。
|
2021-02-01 21:11:41 +08:00
|
|
|
|
|
|
|
|
|
## 许可证
|
|
|
|
|
|
|
|
|
|
`NoneBot` 采用 `MIT` 协议开源,协议文件参考 [LICENSE](./LICENSE)。
|
|
|
|
|
|
|
|
|
|
特别的,由于 `mirai` 使用 `AGPLv3` 协议并要求使用 `mirai` 的软件同样以 `AGPLv3` 协议开源,本项目 `mirai` 适配器部分(即 [`nonebot/adapters/mirai/`](./nonebot/adapters/mirai/) 目录)以 `AGPLv3` 协议开源,协议文件参考 [LICENSE](./nonebot/adapters/mirai/LICENSE)。
|