diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 3b011655..971c8b0e 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -3,7 +3,7 @@ const path = require("path"); module.exports = context => ({ base: process.env.VUEPRESS_BASE || "/", title: "NoneBot", - description: "基于 酷Q 的 Python 异步 QQ 机器人框架", + description: "跨平台 Python 异步 QQ 机器人框架", markdown: { lineNumbers: true }, @@ -56,7 +56,7 @@ module.exports = context => ({ "/": { lang: "zh-CN", title: "NoneBot", - description: "基于 酷Q 的 Python 异步 QQ 机器人框架" + description: "跨平台 Python 异步 QQ 机器人框架" } }, diff --git a/docs/.vuepress/public/manifest.json b/docs/.vuepress/public/manifest.json index dcb62739..8f077d5b 100644 --- a/docs/.vuepress/public/manifest.json +++ b/docs/.vuepress/public/manifest.json @@ -3,7 +3,7 @@ "short_name": "NoneBot", "background-color": "#ffffff", "theme-color": "#ea5252", - "description": "An asynchronous python bot framework.", + "description": "跨平台 Python 异步 QQ 机器人框架", "display": "standalone", "icons": [ { diff --git a/docs/README.md b/docs/README.md index 78cb0fc4..891eb832 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ --- home: true heroImage: /logo.png -tagline: An asynchronous bot framework. +tagline: 跨平台 Python 异步 QQ 机器人框架 actionText: 开始使用 actionLink: guide/ features: diff --git a/docs/advanced/runtime-hook.md b/docs/advanced/runtime-hook.md index 58bca681..935d3ce8 100644 --- a/docs/advanced/runtime-hook.md +++ b/docs/advanced/runtime-hook.md @@ -1 +1 @@ -# 运行时插槽 +# 钩子函数 diff --git a/docs/advanced/scheduler.md b/docs/advanced/scheduler.md index 86280b5f..c58062f1 100644 --- a/docs/advanced/scheduler.md +++ b/docs/advanced/scheduler.md @@ -4,7 +4,7 @@ > Advanced Python Scheduler (APScheduler) is a Python library that lets you schedule your Python code to be executed later, either just once or periodically. You can add new jobs or remove old ones on the fly as you please. If you store your jobs in a database, they will also survive scheduler restarts and maintain their state. When the scheduler is restarted, it will then run all the jobs it should have run while it was offline. -## 从 v1 迁移 +## 从 NoneBot v1 迁移 `APScheduler` 作为 `nonebot` v1 的可选依赖,为众多 bot 提供了方便的定时任务功能。`nonebot2` 已将 `APScheduler` 独立为 `nonebot_plugin_apscheduler` 插件,你可以在 [插件广场](https://v2.nonebot.dev/plugin-store.html) 中找到它。 @@ -21,7 +21,7 @@ nb plugin install nonebot_plugin_apscheduler ``` :::tip 提示 -`nb-cli` 默认通过 `pypi` 安装,你可以使用 `-i [mirror]` 或 `--index [mirror]` 来使用镜像源安装。 +`nb-cli` 默认通过 `pypi` 安装,你可以添加命令参数 `-i [mirror]` 或 `--index [mirror]` 以使用镜像源安装。 ::: ### 通过 poetry @@ -96,10 +96,14 @@ scheduler = require('nonebot_plugin_apscheduler').scheduler 对于大多数情况,我们需要在 `nonebot2` 项目被启动时启动定时任务,则此处设为 `true` +##### 在 `.env` 中添加 + ```bash APSCHEDULER_AUTOSTART=true ``` +##### 在 `bot.py` 中添加 + ```python nonebot.init(apscheduler_autostart=True) ``` @@ -116,10 +120,14 @@ nonebot.init(apscheduler_autostart=True) > 官方文档在绝大多数时候能提供最准确和最具时效性的指南 +##### 在 `.env` 中添加 + ```bash APSCHEDULER_CONFIG={"apscheduler.timezone": "Asia/Shanghai"} ``` +##### 在 `bot.py` 中添加 + ```python nonebot.init(apscheduler_config={ "apscheduler.timezone": "Asia/Shanghai" diff --git a/docs/guide/README.md b/docs/guide/README.md index 4326ac1b..8aa8d271 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -8,8 +8,6 @@ 初次使用时可能会觉得这里的概览过于枯燥,可以先简单略读之后直接前往 [安装](./installation.md) 查看安装方法,并进行后续的基础使用教程。 ::: -## 简介 - NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人收到的事件进行解析和处理,并以插件化的形式,按优先级分发给事件所对应的事件响应器,来完成具体的功能。 除了起到解析事件的作用,NoneBot 还为插件提供了大量实用的预设操作和权限控制机制。对于命令处理,它更是提供了完善且易用的会话机制和内部调用机制,以分别适应命令的连续交互和插件内部功能复用等需求。 diff --git a/docs/guide/basic-configuration.md b/docs/guide/basic-configuration.md index 84ed8fe0..4bb33f4f 100644 --- a/docs/guide/basic-configuration.md +++ b/docs/guide/basic-configuration.md @@ -2,7 +2,7 @@ 到目前为止我们还在使用 NoneBot 的默认行为,在开始编写自己的插件之前,我们先尝试在配置文件上动动手脚,让 NoneBot 表现出不同的行为。 -在上一章节中,我们创建了默认的项目结构,其中 `.env`, `.env.*` 均为项目的配置文件,下面将介绍几种 NoneBot 配置方式。 +在上一章节中,我们创建了默认的项目结构,其中 `.env` 和 `.env.*` 均为项目的配置文件,下面将介绍几种 NoneBot 配置方式。 :::danger 警告 请勿将敏感信息写入配置文件并提交至开源仓库! @@ -83,4 +83,4 @@ config.custom_config4 = "new config after init" ## 优先级 -`bot.py init` > `system env` > `env file` +`bot.py` 文件( `nonebot.init` ) > 系统环境变量 > `.env` `.env.*` 文件 diff --git a/docs/guide/creating-a-project.md b/docs/guide/creating-a-project.md index 5933b5fa..7c488a41 100644 --- a/docs/guide/creating-a-project.md +++ b/docs/guide/creating-a-project.md @@ -34,18 +34,18 @@ AweSome-Bot ## 启动 Bot -如果你使用 `nb-cli` +通过 `nb-cli` ```bash nb run [--file=bot.py] [--app=app] ``` -或者使用 +或 ```bash python bot.py ``` :::tip 提示 -如果在 bot 入口文件内定义了 asgi server, `nb-cli` 将会为你启动**冷重载模式** +如果在 bot 入口文件内定义了 asgi server, `nb-cli` 将会为你启动**冷重载模式**(当文件发生变动时自动重启 NoneBot 实例) ::: diff --git a/docs/guide/ding-guide.md b/docs/guide/ding-guide.md index c23c6827..ee9449ba 100644 --- a/docs/guide/ding-guide.md +++ b/docs/guide/ding-guide.md @@ -1,9 +1,9 @@ # 钉钉机器人使用指南 -基于企业机器人的outgoing(回调)机制,用户@机器人之后,钉钉会将消息内容POST到开发者的消息接收地址。开发者解析出消息内容、发送者身份,根据企业的业务逻辑,组装响应的消息内容返回,钉钉会将响应内容发送到群里。 +基于企业机器人的 outgoing(回调)机制,用户@机器人之后,钉钉会将消息内容 POST 到开发者的消息接收地址。开发者解析出消息内容、发送者身份,根据企业的业务逻辑,组装响应的消息内容返回,钉钉会将响应内容发送到群里。 ::: warning 只有企业内部机器人支持接收消息 -普通的机器人尚不支持应答机制,该机制指的是群里成员在聊天@机器人的时候,钉钉回调指定的服务地址,即Outgoing机器人。 +普通的机器人尚不支持应答机制,该机制指的是群里成员在聊天@机器人的时候,钉钉回调指定的服务地址,即 Outgoing 机器人。 ::: 首先你需要有钉钉机器人的相关概念,请参阅相关文档: diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index edb898a3..f5e61215 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -1,16 +1,16 @@ # 开始使用 -一切都安装成功后,你就已经做好了进行简单配置以运行一个最小的 NoneBot 实例的准备。 +一切都安装成功后,你就已经做好了进行简单配置以运行一个最小的 NoneBot 实例的准备工作。 ## 最小实例 -如果你已经按照推荐方式安装了 `nb-cli`,使用脚手架创建一个空项目: +如果你已经按照推荐方式安装了 `nb-cli`,使用它创建一个空项目: ```bash nb create ``` -根据脚手架引导,将在当前目录下创建一个项目目录,项目目录内包含 `bot.py`。 +根据引导进行项目配置,完成后会在当前目录下创建一个项目目录,项目目录内包含 `bot.py`。 如果未安装 `nb-cli`,使用你最熟悉的编辑器或 IDE,创建一个名为 `bot.py` 的文件,内容如下(这里以 CQHTTP 适配器为例): diff --git a/docs/guide/installation.md b/docs/guide/installation.md index b56da782..aaf916ec 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -7,7 +7,7 @@ ::: :::warning 注意 -请在安装 nonebot2 之前卸载 nonebot 1.x +请在安装 NoneBot v2 之前卸载 NoneBot v1 ```bash pip uninstall nonebot @@ -15,10 +15,10 @@ pip uninstall nonebot ::: -### 通过脚手架安装(推荐安装方式) +### (推荐安装方式)通过脚手架安装 -1. (推荐)使用你喜欢的 Python 环境管理工具(如 `poetry`)创建新的虚拟环境。 -2. 使用 `pip` (或其他包管理工具) 安装 nb-cli,nonebot2 作为其依赖会一起被安装。 +1. (推荐)使用你喜欢的 Python 环境管理工具(如 `poetry`)创建新的虚拟环境 +2. 使用 `pip` 或 其他包管理工具 安装 `nb-cli`,`nonebot2` 会作为其依赖被一起安装 ```bash pip install nb-cli @@ -26,17 +26,17 @@ pip uninstall nonebot 3. 点个 star 吧 - nonebot2: [![nb-cli](https://img.shields.io/github/stars/nonebot/nonebot2?style=social)](https://github.com/nonebot/nonebot2) + nonebot2: [![nonebot2](https://img.shields.io/github/stars/nonebot/nonebot2?style=social)](https://github.com/nonebot/nonebot2) nb-cli: [![nb-cli](https://img.shields.io/github/stars/nonebot/nb-cli?style=social)](https://github.com/nonebot/nb-cli) -4. 如果有疑问,可以加群交流 (点击链接直达) +4. 如果有疑问,可以加群交流(点击链接直达) [![QQ Chat](https://img.shields.io/badge/QQ%E7%BE%A4-768887710-orange?style=social)](https://jq.qq.com/?_wv=1027&k=5OFifDh) [![Telegram Chat](https://img.shields.io/badge/telegram-cqhttp-blue?style=social)](https://t.me/cqhttp) -### 不使用脚手架(纯净安装) +### (纯净安装)不使用脚手架 ```bash pip install nonebot2 @@ -84,8 +84,6 @@ nb plugin install xxx ### 官方插件 -~~自用插件~~ ~~确信~~ - - [NoneBot-Plugin-Docs](https://github.com/nonebot/nonebot2/tree/master/packages/nonebot-plugin-docs) 离线文档插件 - [NoneBot-Plugin-Test](https://github.com/nonebot/plugin-test) 本地机器人测试前端插件 - [NoneBot-Plugin-APScheduler](https://github.com/nonebot/plugin-apscheduler) 定时任务插件 diff --git a/docs/guide/mirai-guide.md b/docs/guide/mirai-guide.md index bd11083c..403e55e0 100644 --- a/docs/guide/mirai-guide.md +++ b/docs/guide/mirai-guide.md @@ -4,7 +4,7 @@ Mirai-API-HTTP 的适配现在仍然处于早期阶段, 可能没有进行过充分的测试 -请在生产环境中谨慎使用 +在生产环境中请谨慎使用 ::: @@ -34,7 +34,7 @@ Mirai-API-HTTP 的适配器以 [AGPLv3 许可](https://opensource.org/licenses/A > 单纯运行 NoneBot 实例并不会产生任何效果,因为此刻 QQ 这边还不知道 NoneBot 的存在,也就无法把消息发送给它,因此现在需要使用一个无头 QQ 来把消息等事件上报给 NoneBot。 -这次, 我们将采用在实现上有别于 onebot即 CQHTTP协议的另外一种无头 QQ API 协议, 即 MAH +这次, 我们将采用在实现上有别于 OneBot(CQHTTP)协议的另外一种无头 QQ API 协议, 即 MAH 为了配置 MAH 端, 我们现在需要移步到[MAH 的项目地址](https://github.com/project-mirai/mirai-api-http), 来看看它是如何配置的