👷 update doc ci

This commit is contained in:
yanyongyu 2021-12-02 03:17:10 +08:00
parent 0236746e65
commit 7d8a60b033
64 changed files with 257 additions and 8378 deletions

View File

@ -1,4 +1,4 @@
name-template: 'v$RESOLVED_VERSION 🌈'
name-template: 'Release v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '💥 Breaking Changes'

View File

@ -1,4 +1,4 @@
name: 'NoneBot2 Publish Bot'
name: NoneBot2 Publish Bot
on:
push:
@ -22,6 +22,6 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}
base: master
plugin_path: docs/.vuepress/public/plugins.json
bot_path: docs/.vuepress/public/bots.json
adapter_path: docs/.vuepress/public/adapters.json
plugin_path: website/static/plugins.json
bot_path: website/static/bots.json
adapter_path: website/static/adapters.json

View File

@ -1,14 +0,0 @@
name: Release Drafter
on:
push:
branches:
- master
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

28
.github/workflows/release-github.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Release Drafter
on:
push:
branches:
- master
tags:
- v*
jobs:
update-release-draft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: release-drafter/release-drafter@v5
if: startsWith(github.ref, 'refs/tags/')
with:
name: Release v${GITHUB_REF#refs/tags/} 🌈
tag: ${GITHUB_REF#refs/tags/}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -14,12 +14,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- run: npm ci
- name: Build Docs
env:
VUEPRESS_BASE: '/docs/'
run: npx vuepress build docs --dest packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
node-version: '16'
- name: Set up Python
uses: actions/setup-python@v2
@ -29,10 +24,14 @@ jobs:
- uses: Gr1N/setup-poetry@v4
- name: Build Docs
run: |
yarn install
yarn build:plugin --out-dir ./packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
- name: Publish Package
run: |
export NONEBOT_VERSION=`poetry version -s`
cd packages/nonebot-plugin-docs/
poetry version $NONEBOT_VERSION
poetry version $(poetry version -s)
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -1,8 +1,7 @@
name: Build API Doc
name: Release
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
@ -11,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: master
- name: Set up Python
uses: actions/setup-python@v2
@ -34,9 +33,18 @@ jobs:
run: poetry run sphinx-build -M markdown ./docs_build ./build
- name: Copy Files
run: cp -r ./build/markdown/* ./docs/api/
run: cp -r ./build/markdown/* ./website/docs/api/
- uses: actions/upload-artifact@v2
with:
name: docs
path: docs/
- name: Archive Files
run: yarn archive $(poetry version -s)
- name: Push Tag and Release to PyPI
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m ":bookmark: Release $(poetry version -s)"
git tag v$(poetry version -s)
git push --tags
poetry build
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}

View File

@ -1,36 +0,0 @@
name: Upload API Doc
on:
workflow_run:
workflows: ["Build API Doc"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.GH_TOKEN }}
- uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: docs
path: docs/
- env:
REF: ${{ github.event.workflow_run.head_branch }}
PR_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
PR_USER: ${{ github.event.workflow_run.head_repository.owner.login }}
run: |
git config user.name $PR_USER
git config user.email $PR_USER@users.noreply.github.com
git add .
git diff-index --quiet HEAD || git commit -m ":memo: update api docs"
git remote add target https://github.com/$PR_REPO.git
git push target HEAD:$REF

View File

@ -2,7 +2,7 @@ name: Build Upload Site
on:
push:
pull_request_target:
pull_request:
jobs:
publish:
@ -22,11 +22,10 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Packages
id: yarn-cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
@ -44,7 +43,6 @@ jobs:
echo "DEPLOY_NAME=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
echo "PRODUCTION=${{ env.BRANCH_NAME == 'master' }}" >> $GITHUB_ENV
- name: Get Deploy Name
if: github.event_name != 'push'
run: |
@ -54,7 +52,7 @@ jobs:
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './docs/.vuepress/dist'
publish-dir: './website/build'
production-deploy: ${{ env.PRODUCTION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}'

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ dev
docs_build/_build
!tests/.env
.docusaurus
website/docs/api/**/*.md
# Created by https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,visualstudiocode,jetbrains,macos,windows,linux

View File

@ -7,24 +7,23 @@ NoneBot Api Reference
=====================
:模块索引:
- `nonebot <nonebot.html>`_
- `nonebot.config <config.html>`_
- `nonebot.plugin <plugin.html>`_
- `nonebot.message <message.html>`_
- `nonebot.matcher <matcher.html>`_
- `nonebot.handler <handler.html>`_
- `nonebot.rule <rule.html>`_
- `nonebot.permission <permission.html>`_
- `nonebot.log <log.html>`_
- `nonebot.utils <utils.html>`_
- `nonebot.typing <typing.html>`_
- `nonebot.exception <exception.html>`_
- `nonebot.drivers <drivers/>`_
- `nonebot.drivers.fastapi <drivers/fastapi.html>`_
- `nonebot.drivers.quart <drivers/quart.html>`_
- `nonebot.drivers.aiohttp <drivers/aiohttp.html>`_
- `nonebot.adapters <adapters/>`_
- `nonebot.adapters.cqhttp <adapters/cqhttp.html>`_
- `nonebot.adapters.ding <adapters/ding.html>`_
- `nonebot.adapters.mirai <adapters/mirai.html>`_
- `nonebot.adapters.feishu <adapters/feishu.html>`_
- `nonebot <./nonebot.md>`_
- `nonebot.config <./config.md>`_
- `nonebot.plugin <./plugin.md>`_
- `nonebot.message <./message.md>`_
- `nonebot.matcher <./matcher.md>`_
- `nonebot.handler <./handler.md>`_
- `nonebot.rule <./rule.md>`_
- `nonebot.permission <./permission.md>`_
- `nonebot.log <./log.md>`_
- `nonebot.utils <./utils.md>`_
- `nonebot.typing <./typing.md>`_
- `nonebot.exception <./exception.md>`_
- `nonebot.drivers <./drivers/README.md>`_
- `nonebot.drivers.fastapi <./drivers/fastapi.md>`_
- `nonebot.drivers.quart <./drivers/quart.md>`_
- `nonebot.drivers.aiohttp <./drivers/aiohttp.md>`_
- `nonebot.adapters <./adapters/README.md>`_
- `nonebot.adapters.ding <./adapters/ding.md>`_
- `nonebot.adapters.mirai <./adapters/mirai.md>`_
- `nonebot.adapters.feishu <./adapters/feishu.md>`_

View File

@ -1,4 +1,7 @@
\-\-\-
id: index
slug: /api/adapters/
\-\-\-
NoneBot.adapters 模块
=====================

View File

@ -1,4 +1,7 @@
\-\-\-
id: index
slug: /api/drivers/
\-\-\-
NoneBot.drivers 模块
=====================

View File

@ -387,7 +387,7 @@ def on_command(
注册一个消息事件响应器并且当消息以指定命令开头时响应
命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_
命令匹配规则参考: `命令形式匹配 <rule.md#command-command>`_
:参数:
@ -499,7 +499,7 @@ def on_regex(
注册一个消息事件响应器并且当消息匹配正则表达式时响应
命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_
命令匹配规则参考: `正则匹配 <rule.md#regex-regex-flags-0>`_
:参数:
@ -851,7 +851,7 @@ class MatcherGroup:
注册一个消息事件响应器并且当消息以指定命令开头时响应
命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_
命令匹配规则参考: `命令形式匹配 <rule.md#command-command>`_
:参数:
@ -928,7 +928,7 @@ class MatcherGroup:
注册一个消息事件响应器并且当消息匹配正则表达式时响应
命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_
命令匹配规则参考: `正则匹配 <rule.md#regex-regex-flags-0>`_
:参数:

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "root",
"private": true,
"workspaces": [
"website"
],
"scripts": {
"archive": "yarn workspace nonebot docusaurus docs:version",
"build": "yarn workspace nonebot build",
"build:plugin": "cross-env BASE_URL='/docs/' yarn workspace nonebot build",
"start": "yarn workspace nonebot start",
"prettier": "prettier --config ./.prettierrc --write \"./website/**/*.md\""
},
"devDependencies": {
"prettier": "^2.5.0"
},
"dependencies": {
"docusaurus-preset-nonepress": "0.0.0-108"
}
}

View File

@ -37,7 +37,7 @@ SEND = "send"
class Bot(BaseBot):
"""
钉钉 协议 Bot 适配继承属性参考 `BaseBot <./#class-basebot>`_ 。
钉钉 协议 Bot 适配继承属性参考 `BaseBot <README.md#class-bot>`_ 。
"""
ding_config: DingConfig

View File

@ -151,7 +151,7 @@ def _handle_api_result(
class Bot(BaseBot):
"""
飞书 协议 Bot 适配继承属性参考 `BaseBot <./#class-basebot>`_ 。
飞书 协议 Bot 适配继承属性参考 `BaseBot <README.md#class-bot>`_ 。
"""
@property

View File

@ -1,12 +1,12 @@
---
sidebar_position: 1
id: advanced
id: index
slug: /advanced
options:
menu:
weight: 10
catogory: advanced
category: advanced
---
# 深入
@ -95,14 +95,14 @@ options:
关于`hook`的更多信息,可以查阅[这里](./runtime-hook.md)
:::
2. **Matcher**与**matcher**,在**指南**中,我们讲述了[如何注册事件响应器](../guide/creating-a-matcher),这里的事件响应器或者说 `Matcher` 并不是一个具体的实例 `instance`,而是一个具有特定属性的类 `class`。只有当 `Matcher` **响应事件**时,才会实例化为具体的 `instance`,也就是 `matcher`。`matcher` 可以认为是 `nonebot` 处理 `Event` 的基本单位,运行 `matcher` 是`nonebot`工作的主要内容。
2. **Matcher**与**matcher**,在**指南**中,我们讲述了[如何注册事件响应器](../guide/creating-a-matcher.md),这里的事件响应器或者说 `Matcher` 并不是一个具体的实例 `instance`,而是一个具有特定属性的类 `class`。只有当 `Matcher` **响应事件**时,才会实例化为具体的 `instance`,也就是 `matcher`。`matcher` 可以认为是 `nonebot` 处理 `Event` 的基本单位,运行 `matcher` 是`nonebot`工作的主要内容。
3. **handler**,或者说**事件处理函数**, 它们可以认为是 `nonebot` 处理 `Event` 的最小单位。在不考虑 `hook` 的情况下,**运行 matcher 就是顺序运行 matcher.handlers**,这句话换种表达方式就是,`handler` 只有添加到 `matcher.handlers` 时,才可以参与到 `nonebot` 的工作中来。
::: tip
如何让 `handler` 添加到 `matcher.handlers`
一方面,我们可以参照[这里](../guide/creating-a-handler)利用装饰器来添加;另一方面,我们在用 `on()` 或者 `on_*()` 注册事件响应器时,可以添加 `handlers=[handler1, handler2, ...]` 这样的关键词参数来添加。
一方面,我们可以参照[这里](../guide/creating-a-handler.md)利用装饰器来添加;另一方面,我们在用 `on()` 或者 `on_*()` 注册事件响应器时,可以添加 `handlers=[handler1, handler2, ...]` 这样的关键词参数来添加。
:::
#### 处理 Event

View File

@ -1,4 +0,0 @@
{
"label": "发布",
"position": 1
}

View File

@ -4,7 +4,7 @@ sidebar_position: 5
options:
menu:
weight: 50
catogory: advanced
category: advanced
---
# 跨插件访问

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -4,7 +4,7 @@ sidebar_position: 6
options:
menu:
weight: 60
catogory: advanced
category: advanced
---
# 事件处理函数重载

View File

@ -4,7 +4,7 @@ sidebar_position: 3
options:
menu:
weight: 30
catogory: advanced
category: advanced
---
# 权限控制

View File

@ -1,10 +1,10 @@
---
sidebar_position: 5
sidebar_position: 7
options:
menu:
weight: 110
catogory: advanced
weight: 70
category: advanced
---
# 发布插件

View File

@ -4,7 +4,7 @@ sidebar_position: 4
options:
menu:
weight: 40
catogory: advanced
category: advanced
---
# 钩子函数

View File

@ -4,7 +4,7 @@ sidebar_position: 2
options:
menu:
weight: 20
catogory: advanced
category: advanced
---
# 定时任务

View File

@ -1,50 +0,0 @@
---
id: index
slug: /api/
---
# NoneBot Api Reference
- **模块索引**
- [nonebot](nonebot.html)
- [nonebot.config](config.html)
- [nonebot.plugin](plugin.html)
- [nonebot.message](message.html)
- [nonebot.matcher](matcher.html)
- [nonebot.handler](handler.html)
- [nonebot.rule](rule.html)
- [nonebot.permission](permission.html)
- [nonebot.log](log.html)
- [nonebot.utils](utils.html)
- [nonebot.typing](typing.html)
- [nonebot.exception](exception.html)
- [nonebot.drivers](drivers/)
- [nonebot.drivers.fastapi](drivers/fastapi.html)
- [nonebot.drivers.quart](drivers/quart.html)
- [nonebot.drivers.aiohttp](drivers/aiohttp.html)
- [nonebot.adapters](adapters/)
- [nonebot.adapters.cqhttp](adapters/cqhttp.html)
- [nonebot.adapters.ding](adapters/ding.html)
- [nonebot.adapters.mirai](adapters/mirai.html)
- [nonebot.adapters.feishu](adapters/feishu.html)

View File

@ -1,574 +0,0 @@
# NoneBot.adapters 模块
## 协议适配基类
各协议请继承以下基类,并使用 `driver.register_adapter` 注册适配器
## _class_ `Bot`
基类:`abc.ABC`
Bot 基类。用于处理上报消息,并提供 API 调用接口。
### `driver`
Driver 对象
### `config`
Config 配置对象
### `_calling_api_hook`
* **类型**
`Set[T_CallingAPIHook]`
* **说明**
call_api 时执行的函数
### `_called_api_hook`
* **类型**
`Set[T_CalledAPIHook]`
* **说明**
call_api 后执行的函数
### `__init__(self_id, request)`
* **参数**
* `self_id: str`: 机器人 ID
* `request: HTTPConnection`: request 连接对象
### `self_id`
机器人 ID
### `request`
连接信息
### _abstract property_ `type`
Adapter 类型
### _classmethod_ `register(driver, config, **kwargs)`
* **说明**
`register` 方法会在 `driver.register_adapter` 时被调用,用于初始化相关配置
### _abstract async classmethod_ `check_permission(driver, request)`
* **说明**
检查连接请求是否合法的函数,如果合法则返回当前连接 `唯一标识符`,通常为机器人 ID如果不合法则抛出 `RequestDenied` 异常。
* **参数**
* `driver: Driver`: Driver 对象
* `request: HTTPConnection`: request 请求详情
* **返回**
* `Optional[str]`: 连接唯一标识符,`None` 代表连接不合法
* `Optional[HTTPResponse]`: HTTP 上报响应
### _abstract async_ `handle_message(message)`
* **说明**
处理上报消息的函数,转换为 `Event` 事件后调用 `nonebot.message.handle_event` 进一步处理事件。
* **参数**
* `message: bytes`: 收到的上报消息
### _abstract async_ `_call_api(api, **data)`
* **说明**
`adapter` 实际调用 api 的逻辑实现函数,实现该方法以调用 api。
* **参数**
* `api: str`: API 名称
* `**data`: API 数据
### _async_ `call_api(api, **data)`
* **说明**
调用机器人 API 接口,可以通过该函数或直接通过 bot 属性进行调用
* **参数**
* `api: str`: API 名称
* `**data`: API 数据
* **示例**
```python
await bot.call_api("send_msg", message="hello world")
await bot.send_msg(message="hello world")
```
### _abstract async_ `send(event, message, **kwargs)`
* **说明**
调用机器人基础发送消息接口
* **参数**
* `event: Event`: 上报事件
* `message: Union[str, Message, MessageSegment]`: 要发送的消息
* `**kwargs`
### _classmethod_ `on_calling_api(func)`
* **说明**
调用 api 预处理。
* **参数**
* `bot: Bot`: 当前 bot 对象
* `api: str`: 调用的 api 名称
* `data: Dict[str, Any]`: api 调用的参数字典
### _classmethod_ `on_called_api(func)`
* **说明**
调用 api 后处理。
* **参数**
* `bot: Bot`: 当前 bot 对象
* `exception: Optional[Exception]`: 调用 api 时发生的错误
* `api: str`: 调用的 api 名称
* `data: Dict[str, Any]`: api 调用的参数字典
* `result: Any`: api 调用的返回
## _class_ `MessageSegment`
基类:`Mapping`, `abc.ABC`, `Generic`[`nonebot.adapters._message.TM`]
消息段基类
### `type`
* 类型: `str`
* 说明: 消息段类型
### `data`
* 类型: `Dict[str, Union[str, list]]`
* 说明: 消息段数据
## _class_ `Message`
基类:`List`[`nonebot.adapters._message.TMS`], `abc.ABC`
消息数组
### `__init__(message=None, *args, **kwargs)`
* **参数**
* `message: Union[str, list, dict, MessageSegment, Message, Any]`: 消息内容
### _classmethod_ `template(format_string)`
* **说明**
根据创建消息模板, 用法和 `str.format` 大致相同, 但是可以输出消息对象, 并且支持以 `Message` 对象作为消息模板
并且提供了拓展的格式化控制符, 可以用适用于该消息类型的 `MessageSegment` 的工厂方法创建消息
* **示例**
```python
>>> Message.template("{} {}").format("hello", "world") # 基础演示
Message(MessageSegment(type='text', data={'text': 'hello world'}))
>>> Message.template("{} {}").format(MessageSegment.image("file///..."), "world") # 支持消息段等对象
Message(MessageSegment(type='image', data={'file': 'file///...'}), MessageSegment(type='text', data={'text': 'world'}))
>>> Message.template( # 支持以Message对象作为消息模板
... MessageSegment.text('test {event.user_id}') + MessageSegment.face(233) +
... MessageSegment.text('test {event.message}')).format(event={'user_id':123456, 'message':'hello world'})
Message(MessageSegment(type='text', data={'text': 'test 123456'}),
MessageSegment(type='face', data={'face': 233}),
MessageSegment(type='text', data={'text': 'test hello world'}))
>>> Message.template("{link:image}").format(link='https://...') # 支持拓展格式化控制符
Message(MessageSegment(type='image', data={'file': 'https://...'}))
```
* **参数**
* `format_string: str`: 格式化字符串
* **返回**
* `MessageFormatter[TM]`: 消息格式化器
### `append(obj)`
* **说明**
添加一个消息段到消息数组末尾
* **参数**
* `obj: Union[str, MessageSegment]`: 要添加的消息段
### `extend(obj)`
* **说明**
拼接一个消息数组或多个消息段到消息数组末尾
* **参数**
* `obj: Union[Message, Iterable[MessageSegment]]`: 要添加的消息数组
### `extract_plain_text()`
* **说明**
提取消息内纯文本消息
## _class_ `Event`
基类:`abc.ABC`, `pydantic.main.BaseModel`
Event 基类。提供获取关键信息的方法,其余信息可直接获取。
### _abstract_ `get_type()`
* **说明**
获取事件类型的方法,类型通常为 NoneBot 内置的四种类型。
* **返回**
* `Literal["message", "notice", "request", "meta_event"]`
* 其他自定义 `str`
### _abstract_ `get_event_name()`
* **说明**
获取事件名称的方法。
* **返回**
* `str`
### _abstract_ `get_event_description()`
* **说明**
获取事件描述的方法,通常为事件具体内容。
* **返回**
* `str`
### `get_log_string()`
* **说明**
获取事件日志信息的方法,通常你不需要修改这个方法,只有当希望 NoneBot 隐藏该事件日志时,可以抛出 `NoLogException` 异常。
* **返回**
* `str`
* **异常**
* `NoLogException`
### _abstract_ `get_user_id()`
* **说明**
获取事件主体 id 的方法,通常是用户 id 。
* **返回**
* `str`
### _abstract_ `get_session_id()`
* **说明**
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
* **返回**
* `str`
### _abstract_ `get_message()`
* **说明**
获取事件消息内容的方法。
* **返回**
* `Message`
### `get_plaintext()`
* **说明**
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
* **返回**
* `str`
### _abstract_ `is_tome()`
* **说明**
获取事件是否与机器人有关的方法。
* **返回**
* `bool`
## _class_ `MessageTemplate`
基类:`string.Formatter`, `Generic`[`nonebot.adapters._template.TF`]
消息模板格式化实现类
### `__init__(template, factory=<class 'str'>)`
* **说明**
创建一个模板
* **参数**
* `template: Union[str, Message]`: 模板
* `factory: Union[str, Message]`: 消息构造类型,默认为 str
### `format(*args, **kwargs)`
* **说明**
根据模板和参数生成消息对象

View File

@ -1,329 +0,0 @@
# NoneBot.adapters.ding 模块
## 钉钉群机器人 协议适配
协议详情请看: [钉钉文档](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p)
# NoneBot.adapters.ding.config 模块
## _class_ `Config`
钉钉配置类
* **配置项**
* `access_token` / `ding_access_token`: 钉钉令牌
* `secret` / `ding_secret`: 钉钉 HTTP 上报数据签名口令
# NoneBot.adapters.ding.exception 模块
## _exception_ `DingAdapterException`
基类:[`nonebot.exception.AdapterException`](../exception.md#nonebot.exception.AdapterException)
* **说明**
钉钉 Adapter 错误基类
## _exception_ `ActionFailed`
基类:[`nonebot.exception.ActionFailed`](../exception.md#nonebot.exception.ActionFailed), `nonebot.adapters.ding.exception.DingAdapterException`
* **说明**
API 请求返回错误信息。
* **参数**
* `errcode: Optional[int]`: 错误码
* `errmsg: Optional[str]`: 错误信息
## _exception_ `NetworkError`
基类:[`nonebot.exception.NetworkError`](../exception.md#nonebot.exception.NetworkError), `nonebot.adapters.ding.exception.DingAdapterException`
* **说明**
网络错误。
* **参数**
* `retcode: Optional[int]`: 错误码
## _exception_ `SessionExpired`
基类:`nonebot.adapters.ding.exception.ApiNotAvailable`, `nonebot.adapters.ding.exception.DingAdapterException`
* **说明**
发消息的 session 已经过期。
# NoneBot.adapters.ding.bot 模块
## _class_ `Bot`
基类:[`nonebot.adapters._bot.Bot`](README.md#nonebot.adapters._bot.Bot)
钉钉 协议 Bot 适配。继承属性参考 [BaseBot](./#class-basebot) 。
### _property_ `type`
* 返回: `"ding"`
### _async classmethod_ `check_permission(driver, request)`
* **说明**
钉钉协议鉴权。参考 [鉴权](https://ding-doc.dingtalk.com/doc#/serverapi2/elzz1p)
### _async_ `call_api(api, event=None, **data)`
* **说明**
调用 钉钉 协议 API
* **参数**
* `api: str`: API 名称
* `event: Optional[MessageEvent]`: Event 对象
* `**data: Any`: API 参数
* **返回**
* `Any`: API 调用返回数据
* **异常**
* `NetworkError`: 网络错误
* `ActionFailed`: API 调用失败
### _async_ `send(event, message, at_sender=False, webhook=None, secret=None, **kwargs)`
* **说明**
根据 `event` 向触发事件的主体发送消息。
* **参数**
* `event: Event`: Event 对象
* `message: Union[str, Message, MessageSegment]`: 要发送的消息
* `at_sender: bool`: 是否 @ 事件主体
* `webhook: Optional[str]`: 该条消息将调用的 webhook 地址。不传则将使用 sessionWebhook若其也不存在该条消息不发送使用自定义 webhook 时注意你设置的安全方式如加关键词IP地址加签等等。
* `secret: Optional[str]`: 如果你使用自定义的 webhook 地址,推荐使用加签方式对消息进行验证,将 机器人安全设置页面加签一栏下面显示的SEC开头的字符串 传入这个参数即可。
* `**kwargs`: 覆盖默认参数
* **返回**
* `Any`: API 调用返回数据
* **异常**
* `ValueError`: 缺少 `user_id`, `group_id`
* `NetworkError`: 网络错误
* `ActionFailed`: API 调用失败
# NoneBot.adapters.ding.message 模块
## _class_ `MessageSegment`
基类:[`nonebot.adapters._message.MessageSegment`](README.md#nonebot.adapters._message.MessageSegment)[`Message`]
钉钉 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。
### _static_ `atAll()`
@全体
### _static_ `atMobiles(*mobileNumber)`
@指定手机号人员
### _static_ `atDingtalkIds(*dingtalkIds)`
@指定 id@ 默认会在消息段末尾。
所以你可以在消息中使用 @{senderId} 占位,发送出去之后 @ 就会出现在占位的位置:
``python
message = MessageSegment.text(f"@{event.senderId},你好")
message += MessageSegment.atDingtalkIds(event.senderId)
``
### _static_ `text(text)`
发送 `text` 类型消息
### _static_ `image(picURL)`
发送 `image` 类型消息
### _static_ `extension(dict_)`
标记 text 文本的 extension 属性,需要与 text 消息段相加。
### _static_ `code(code_language, code)`
发送 code 消息段
### _static_ `markdown(title, text)`
发送 `markdown` 类型消息
### _static_ `actionCardSingleBtn(title, text, singleTitle, singleURL)`
发送 `actionCardSingleBtn` 类型消息
### _static_ `actionCardMultiBtns(title, text, btns, hideAvatar=False, btnOrientation='1')`
发送 `actionCardMultiBtn` 类型消息
* **参数**
* `btnOrientation`: 0按钮竖直排列 1按钮横向排列
* `btns`: `[{ "title": title, "actionURL": actionURL }, ...]`
### _static_ `feedCard(links)`
发送 `feedCard` 类型消息
* **参数**
* `links`: `[{ "title": xxx, "messageURL": xxx, "picURL": xxx }, ...]`
## _class_ `Message`
基类:[`nonebot.adapters._message.Message`](README.md#nonebot.adapters._message.Message)[`nonebot.adapters.ding.message.MessageSegment`]
钉钉 协议 Message 适配。
# NoneBot.adapters.ding.event 模块
## _class_ `Event`
基类:[`nonebot.adapters._event.Event`](README.md#nonebot.adapters._event.Event)
钉钉协议事件。各事件字段参考 [钉钉文档](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p)
## _class_ `ConversationType`
基类:`str`, `enum.Enum`
An enumeration.
## _class_ `MessageEvent`
基类:`nonebot.adapters.ding.event.Event`
消息事件
## _class_ `PrivateMessageEvent`
基类:`nonebot.adapters.ding.event.MessageEvent`
私聊消息事件
## _class_ `GroupMessageEvent`
基类:`nonebot.adapters.ding.event.MessageEvent`
群消息事件

View File

@ -1,244 +0,0 @@
# NoneBot.adapters.feishu 模块
# NoneBot.adapters.feishu.config 模块
## _class_ `Config`
飞书配置类
* **配置项**
* `app_id` / `feishu_app_id`: 飞书开放平台后台“凭证与基础信息”处给出的 App ID
* `app_secret` / `feishu_app_secret`: 飞书开放平台后台“凭证与基础信息”处给出的 App Secret
* `encrypt_key` / `feishu_encrypt_key`: 飞书开放平台后台“事件订阅”处设置的 Encrypt Key
* `verification_token` / `feishu_verification_token`: 飞书开放平台后台“事件订阅”处设置的 Verification Token
* `tenant_access_token` / `feishu_tenant_access_token`: 请求飞书 API 后返回的租户密钥
* `is_lark` / `feishu_is_lark`: 是否使用Lark飞书海外版默认为 false
# NoneBot.adapters.feishu.exception 模块
## _exception_ `ActionFailed`
基类:[`nonebot.exception.ActionFailed`](../exception.md#nonebot.exception.ActionFailed), `nonebot.adapters.feishu.exception.FeishuAdapterException`
* **说明**
API 请求返回错误信息。
* **参数**
* `retcode: Optional[int]`: 错误码
## _exception_ `NetworkError`
基类:[`nonebot.exception.NetworkError`](../exception.md#nonebot.exception.NetworkError), `nonebot.adapters.feishu.exception.FeishuAdapterException`
* **说明**
网络错误。
* **参数**
* `retcode: Optional[int]`: 错误码
# NoneBot.adapters.feishu.bot 模块
## `_check_at_me(bot, event)`
* **说明**
检查消息开头或结尾是否存在 @机器人,去除并赋值 `event.reply`, `event.to_me`
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: Event 对象
## `_check_nickname(bot, event)`
* **说明**
检查消息开头是否存在昵称,去除并赋值 `event.to_me`
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: Event 对象
## `_handle_api_result(result)`
* **说明**
处理 API 请求返回值。
* **参数**
* `result: Optional[Dict[str, Any]]`: API 返回数据
* **返回**
* `Any`: API 调用返回数据
* **异常**
* `ActionFailed`: API 调用失败
## _class_ `Bot`
基类:[`nonebot.adapters._bot.Bot`](README.md#nonebot.adapters._bot.Bot)
飞书 协议 Bot 适配。继承属性参考 [BaseBot](./#class-basebot) 。
### _async_ `handle_message(message)`
* **说明**
处理事件并转换为 [Event](#class-event)
### _async_ `call_api(api, **data)`
* **说明**
调用 飞书 协议 API
* **参数**
* `api: str`: API 名称
* `**data: Any`: API 参数
* **返回**
* `Any`: API 调用返回数据
* **异常**
* `NetworkError`: 网络错误
* `ActionFailed`: API 调用失败
# NoneBot.adapters.feishu.message 模块
## _class_ `MessageSegment`
基类:[`nonebot.adapters._message.MessageSegment`](README.md#nonebot.adapters._message.MessageSegment)[`Message`]
飞书 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。
## _class_ `Message`
基类:[`nonebot.adapters._message.Message`](README.md#nonebot.adapters._message.Message)[`nonebot.adapters.feishu.message.MessageSegment`]
飞书 协议 Message 适配。
## _class_ `MessageSerializer`
基类:`object`
飞书 协议 Message 序列化器。
## _class_ `MessageDeserializer`
基类:`object`
飞书 协议 Message 反序列化器。
# NoneBot.adapters.feishu.event 模块
## _class_ `Event`
基类:[`nonebot.adapters._event.Event`](README.md#nonebot.adapters._event.Event)
飞书协议事件。各事件字段参考 [飞书文档](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list)
## `get_event_model(event_name)`
* **说明**
根据事件名获取对应 `Event Model``FallBack Event Model` 列表
* **返回**
* `List[Type[Event]]`

File diff suppressed because it is too large Load Diff

View File

@ -1,306 +0,0 @@
# NoneBot.config 模块
## 配置
NoneBot 使用 [pydantic](https://pydantic-docs.helpmanual.io/) 以及 [python-dotenv](https://saurabh-kumar.com/python-dotenv/) 来读取配置。
配置项需符合特殊格式或 json 序列化格式。详情见 [pydantic Field Type](https://pydantic-docs.helpmanual.io/usage/types/) 文档。
## _class_ `Env`
基类:`nonebot.config.BaseConfig`
运行环境配置。大小写不敏感。
将会从 `nonebot.init 参数` > `环境变量` > `.env 环境配置文件` 的优先级读取配置。
### `environment`
* **类型**: `str`
* **默认值**: `"prod"`
* **说明**
当前环境名。 NoneBot 将从 `.env.{environment}` 文件中加载配置。
## _class_ `Config`
基类:`nonebot.config.BaseConfig`
NoneBot 主要配置。大小写不敏感。
除了 NoneBot 的配置项外,还可以自行添加配置项到 `.env.{environment}` 文件中。
这些配置将会在 json 反序列化后一起带入 `Config` 类中。
### `driver`
* **类型**: `str`
* **默认值**: `"nonebot.drivers.fastapi"`
* **说明**
NoneBot 运行所使用的 `Driver` 。继承自 `nonebot.driver.BaseDriver`
配置格式为 `<module>[:<class>]`,默认类名为 `Driver`
### `host`
* **类型**: `IPvAnyAddress`
* **默认值**: `127.0.0.1`
* **说明**
NoneBot 的 HTTP 和 WebSocket 服务端监听的 IP/主机名。
### `port`
* **类型**: `int`
* **默认值**: `8080`
* **说明**
NoneBot 的 HTTP 和 WebSocket 服务端监听的端口。
### `debug`
* **类型**: `bool`
* **默认值**: `False`
* **说明**
是否以调试模式运行 NoneBot。
### `log_level`
* **类型**: `Union[int, str]`
* **默认值**: `None`
* **说明**
配置 NoneBot 日志输出等级,可以为 `int` 类型等级或等级名称,参考 [loguru 日志等级](https://loguru.readthedocs.io/en/stable/api/logger.html#levels)。
* **示例**
```default
LOG_LEVEL=25
LOG_LEVEL=INFO
```
### `api_root`
* **类型**: `Dict[str, str]`
* **默认值**: `{}`
* **说明**
以机器人 ID 为键,上报地址为值的字典,环境变量或文件中应使用 json 序列化。
* **示例**
```default
API_ROOT={"123456": "http://127.0.0.1:5700"}
```
### `api_timeout`
* **类型**: `Optional[float]`
* **默认值**: `30.`
* **说明**
API 请求超时时间,单位: 秒。
### `access_token`
* **类型**: `Optional[str]`
* **默认值**: `None`
* **说明**
API 请求以及上报所需密钥,在请求头中携带。
* **示例**
```http
POST /cqhttp/ HTTP/1.1
Authorization: Bearer kSLuTF2GC2Q4q4ugm3
```
### `secret`
* **类型**: `Optional[str]`
* **默认值**: `None`
* **说明**
HTTP POST 形式上报所需签名,在请求头中携带。
* **示例**
```http
POST /cqhttp/ HTTP/1.1
X-Signature: sha1=f9ddd4863ace61e64f462d41ca311e3d2c1176e2
```
### `superusers`
* **类型**: `Set[str]`
* **默认值**: `set()`
* **说明**
机器人超级用户。
* **示例**
```default
SUPERUSERS=["12345789"]
```
### `nickname`
* **类型**: `Set[str]`
* **默认值**: `set()`
* **说明**
机器人昵称。
### `command_start`
* **类型**: `Set[str]`
* **默认值**: `{"/"}`
* **说明**
命令的起始标记,用于判断一条消息是不是命令。
### `command_sep`
* **类型**: `Set[str]`
* **默认值**: `{"."}`
* **说明**
命令的分隔标记,用于将文本形式的命令切分为元组(实际的命令名)。
### `session_expire_timeout`
* **类型**: `timedelta`
* **默认值**: `timedelta(minutes=2)`
* **说明**
等待用户回复的超时时间。
* **示例**
```default
SESSION_EXPIRE_TIMEOUT=120 # 单位: 秒
SESSION_EXPIRE_TIMEOUT=[DD ][HH:MM]SS[.ffffff]
SESSION_EXPIRE_TIMEOUT=P[DD]DT[HH]H[MM]M[SS]S # ISO 8601
```

View File

@ -1,38 +0,0 @@
# NoneBot.handler 模块
## 依赖注入处理模块
该模块实现了依赖注入的定义与处理。
## `Depends(dependency=None, *, use_cache=True)`
* **说明**
参数依赖注入装饰器
* **参数**
* `dependency: Optional[Callable[..., Any]] = None`: 依赖函数。默认为参数的类型注释。
* `use_cache: bool = True`: 是否使用缓存。默认为 `True`
```python
def depend_func() -> Any:
return ...
def depend_gen_func():
try:
yield ...
finally:
...
async def handler(param_name: Any = Depends(depend_func), gen: Any = Depends(depend_gen_func)):
...
```

View File

@ -1,529 +0,0 @@
# NoneBot.drivers 模块
## 后端驱动适配基类
各驱动请继承以下基类
## _class_ `Driver`
基类:`abc.ABC`
Driver 基类。
### `_adapters`
* **类型**
`Dict[str, Type[Bot]]`
* **说明**
已注册的适配器列表
### `_bot_connection_hook`
* **类型**
`Set[T_BotConnectionHook]`
* **说明**
Bot 连接建立时执行的函数
### `_bot_disconnection_hook`
* **类型**
`Set[T_BotDisconnectionHook]`
* **说明**
Bot 连接断开时执行的函数
### `__init__(env, config)`
* **参数**
* `env: Env`: 包含环境信息的 Env 对象
* `config: Config`: 包含配置信息的 Config 对象
### `env`
* **类型**
`str`
* **说明**
环境名称
### `config`
* **类型**
`Config`
* **说明**
配置对象
### `_clients`
* **类型**
`Dict[str, Bot]`
* **说明**
已连接的 Bot
### _property_ `bots`
* **类型**
`Dict[str, Bot]`
* **说明**
获取当前所有已连接的 Bot
### `register_adapter(name, adapter, **kwargs)`
* **说明**
注册一个协议适配器
* **参数**
* `name: str`: 适配器名称,用于在连接时进行识别
* `adapter: Type[Bot]`: 适配器 Class
* `**kwargs`: 其他传递给适配器的参数
### _abstract property_ `type`
驱动类型名称
### _abstract property_ `logger`
驱动专属 logger 日志记录器
### _abstract_ `run(*args, **kwargs)`
* **说明**
启动驱动框架
* **参数**
* `*args`
* `**kwargs`
### _abstract_ `on_startup(func)`
注册一个在驱动启动时运行的函数
### _abstract_ `on_shutdown(func)`
注册一个在驱动停止时运行的函数
### `on_bot_connect(func)`
* **说明**
装饰一个函数使他在 bot 通过 WebSocket 连接成功时执行。
* **函数参数**
* `bot: Bot`: 当前连接上的 Bot 对象
### `on_bot_disconnect(func)`
* **说明**
装饰一个函数使他在 bot 通过 WebSocket 连接断开时执行。
* **函数参数**
* `bot: Bot`: 当前连接上的 Bot 对象
### `_bot_connect(bot)`
在 WebSocket 连接成功后,调用该函数来注册 bot 对象
### `_bot_disconnect(bot)`
在 WebSocket 连接断开后,调用该函数来注销 bot 对象
## _class_ `ForwardDriver`
基类:`nonebot.drivers.Driver`
Forward Driver 基类。将客户端框架封装,以满足适配器使用。
### _abstract_ `setup_http_polling(setup)`
* **说明**
注册一个 HTTP 轮询连接,如果传入一个函数,则该函数会在每次连接时被调用
* **参数**
* `setup: Union[HTTPPollingSetup, Callable[[], Awaitable[HTTPPollingSetup]]]`
### _abstract_ `setup_websocket(setup)`
* **说明**
注册一个 WebSocket 连接,如果传入一个函数,则该函数会在每次重连时被调用
* **参数**
* `setup: Union[WebSocketSetup, Callable[[], Awaitable[WebSocketSetup]]]`
## _class_ `ReverseDriver`
基类:`nonebot.drivers.Driver`
Reverse Driver 基类。将后端框架封装,以满足适配器使用。
### _abstract property_ `server_app`
驱动 APP 对象
### _abstract property_ `asgi`
驱动 ASGI 对象
## _class_ `HTTPConnection`
基类:`abc.ABC`
### `http_version`
One of `"1.0"`, `"1.1"` or `"2"`.
### `scheme`
URL scheme portion (likely `"http"` or `"https"`).
### `path`
HTTP request target excluding any query string,
with percent-encoded sequences and UTF-8 byte sequences
decoded into characters.
### `query_string`
URL portion after the `?`, percent-encoded.
### `headers`
A dict of name-value pairs,
where name is the header name, and value is the header value.
Order of header values must be preserved from the original HTTP request;
order of header names is not important.
Header names must be lowercased.
### _abstract property_ `type`
Connection type.
## _class_ `HTTPRequest`
基类:`nonebot.drivers.HTTPConnection`
HTTP 请求封装。参考 [asgi http scope](https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope)。
### `method`
The HTTP method name, uppercased.
### `body`
Body of the request.
Optional; if missing defaults to `b""`.
### _property_ `type`
Always `http`
## _class_ `HTTPResponse`
基类:`object`
HTTP 响应封装。参考 [asgi http scope](https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope)。
### `status`
HTTP status code.
### `body`
HTTP body content.
Optional; if missing defaults to `None`.
### `headers`
A dict of name-value pairs,
where name is the header name, and value is the header value.
Order must be preserved in the HTTP response.
Header names must be lowercased.
Optional; if missing defaults to an empty dict.
### _property_ `type`
Always `http`
## _class_ `WebSocket`
基类:`nonebot.drivers.HTTPConnection`, `abc.ABC`
WebSocket 连接封装。参考 [asgi websocket scope](https://asgi.readthedocs.io/en/latest/specs/www.html#websocket-connection-scope)。
### _property_ `type`
Always `websocket`
### _abstract property_ `closed`
* **类型**
`bool`
* **说明**
连接是否已经关闭
### _abstract async_ `accept()`
接受 WebSocket 连接请求
### _abstract async_ `close(code)`
关闭 WebSocket 连接请求
### _abstract async_ `receive()`
接收一条 WebSocket text 信息
### _abstract async_ `receive_bytes()`
接收一条 WebSocket binary 信息
### _abstract async_ `send(data)`
发送一条 WebSocket text 信息
### _abstract async_ `send_bytes(data)`
发送一条 WebSocket binary 信息
## _class_ `HTTPPollingSetup`
基类:`object`
### `adapter`
协议适配器名称
### `self_id`
机器人 ID
### `url`
URL
### `method`
HTTP method
### `body`
HTTP body
### `headers`
HTTP headers
### `http_version`
HTTP version
### `poll_interval`
HTTP 轮询间隔
## _class_ `WebSocketSetup`
基类:`object`
### `adapter`
协议适配器名称
### `self_id`
机器人 ID
### `url`
URL
### `headers`
HTTP headers
### `reconnect`
WebSocket 是否重连
### `reconnect_interval`
WebSocket 重连间隔

View File

@ -1,96 +0,0 @@
# NoneBot.drivers.aiohttp 模块
## AIOHTTP 驱动适配
本驱动仅支持客户端连接
## _class_ `Driver`
基类:[`nonebot.drivers.ForwardDriver`](README.md#nonebot.drivers.ForwardDriver)
AIOHTTP 驱动框架
### _property_ `type`
驱动名称: `aiohttp`
### _property_ `logger`
aiohttp driver 使用的 logger
### `on_startup(func)`
* **说明**
注册一个启动时执行的函数
* **参数**
* `func: Callable[[], Awaitable[None]]`
### `on_shutdown(func)`
* **说明**
注册一个停止时执行的函数
* **参数**
* `func: Callable[[], Awaitable[None]]`
### `setup_http_polling(setup)`
* **说明**
注册一个 HTTP 轮询连接,如果传入一个函数,则该函数会在每次连接时被调用
* **参数**
* `setup: Union[HTTPPollingSetup, Callable[[], Awaitable[HTTPPollingSetup]]]`
### `setup_websocket(setup)`
* **说明**
注册一个 WebSocket 连接,如果传入一个函数,则该函数会在每次重连时被调用
* **参数**
* `setup: Union[WebSocketSetup, Callable[[], Awaitable[WebSocketSetup]]]`
### `run(*args, **kwargs)`
启动 aiohttp driver
## _class_ `WebSocket`
基类:[`nonebot.drivers.WebSocket`](README.md#nonebot.drivers.WebSocket)

View File

@ -1,249 +0,0 @@
# NoneBot.drivers.fastapi 模块
## FastAPI 驱动适配
本驱动同时支持服务端以及客户端连接
后端使用方法请参考: [FastAPI 文档](https://fastapi.tiangolo.com/)
## _class_ `Config`
基类:`pydantic.env_settings.BaseSettings`
FastAPI 驱动框架设置,详情参考 FastAPI 文档
### `fastapi_openapi_url`
* **类型**
`Optional[str]`
* **说明**
`openapi.json` 地址,默认为 `None` 即关闭
### `fastapi_docs_url`
* **类型**
`Optional[str]`
* **说明**
`swagger` 地址,默认为 `None` 即关闭
### `fastapi_redoc_url`
* **类型**
`Optional[str]`
* **说明**
`redoc` 地址,默认为 `None` 即关闭
### `fastapi_reload`
* **类型**
`Optional[bool]`
* **说明**
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
### `fastapi_reload_dirs`
* **类型**
`Optional[List[str]]`
* **说明**
重载监控文件夹列表,默认为 uvicorn 默认值
### `fastapi_reload_delay`
* **类型**
`Optional[float]`
* **说明**
重载延迟,默认为 uvicorn 默认值
### `fastapi_reload_includes`
* **类型**
`Optional[List[str]]`
* **说明**
要监听的文件列表,支持 glob pattern默认为 uvicorn 默认值
### `fastapi_reload_excludes`
* **类型**
`Optional[List[str]]`
* **说明**
不要监听的文件列表,支持 glob pattern默认为 uvicorn 默认值
## _class_ `Driver`
基类:[`nonebot.drivers.ReverseDriver`](README.md#nonebot.drivers.ReverseDriver)
FastAPI 驱动框架。包含反向 Server 功能。
* **上报地址**
* `/{adapter name}/`: HTTP POST 上报
* `/{adapter name}/http/`: HTTP POST 上报
* `/{adapter name}/ws`: WebSocket 上报
* `/{adapter name}/ws/`: WebSocket 上报
### _property_ `type`
驱动名称: `fastapi`
### _property_ `server_app`
`FastAPI APP` 对象
### _property_ `asgi`
`FastAPI APP` 对象
### _property_ `logger`
fastapi 使用的 logger
### `on_startup(func)`
参考文档: [Events](https://fastapi.tiangolo.com/advanced/events/#startup-event)
### `on_shutdown(func)`
参考文档: [Events](https://fastapi.tiangolo.com/advanced/events/#startup-event)
### `run(host=None, port=None, *, app=None, **kwargs)`
使用 `uvicorn` 启动 FastAPI
## _class_ `FullDriver`
基类:[`nonebot.drivers.ForwardDriver`](README.md#nonebot.drivers.ForwardDriver), `nonebot.drivers.fastapi.Driver`
完整的 FastAPI 驱动框架,包含正向 Client 支持和反向 Server 支持。
* **使用方法**
```dotenv
DRIVER=nonebot.drivers.fastapi:FullDriver
```
### _property_ `type`
驱动名称: `fastapi_full`
### `setup_http_polling(setup)`
* **说明**
注册一个 HTTP 轮询连接,如果传入一个函数,则该函数会在每次连接时被调用
* **参数**
* `setup: Union[HTTPPollingSetup, Callable[[], Awaitable[HTTPPollingSetup]]]`
### `setup_websocket(setup)`
* **说明**
注册一个 WebSocket 连接,如果传入一个函数,则该函数会在每次重连时被调用
* **参数**
* `setup: Union[WebSocketSetup, Callable[[], Awaitable[WebSocketSetup]]]`
## _class_ `WebSocket`
基类:[`nonebot.drivers.WebSocket`](README.md#nonebot.drivers.WebSocket)

View File

@ -1,144 +0,0 @@
# NoneBot.drivers.quart 模块
## Quart 驱动适配
后端使用方法请参考: [Quart 文档](https://pgjones.gitlab.io/quart/index.html)
## _class_ `Config`
基类:`pydantic.env_settings.BaseSettings`
Quart 驱动框架设置
### `quart_reload`
* **类型**
`Optional[bool]`
* **说明**
开启/关闭冷重载,默认会在配置了 app 的 debug 模式启用
### `quart_reload_dirs`
* **类型**
`Optional[List[str]]`
* **说明**
重载监控文件夹列表,默认为 uvicorn 默认值
### `quart_reload_delay`
* **类型**
`Optional[float]`
* **说明**
重载延迟,默认为 uvicorn 默认值
### `quart_reload_includes`
* **类型**
`Optional[List[str]]`
* **说明**
要监听的文件列表,支持 glob pattern默认为 uvicorn 默认值
### `quart_reload_excludes`
* **类型**
`Optional[List[str]]`
* **说明**
不要监听的文件列表,支持 glob pattern默认为 uvicorn 默认值
## _class_ `Driver`
基类:[`nonebot.drivers.ReverseDriver`](README.md#nonebot.drivers.ReverseDriver)
Quart 驱动框架
* **上报地址**
* `/{adapter name}/http`: HTTP POST 上报
* `/{adapter name}/ws`: WebSocket 上报
### _property_ `type`
驱动名称: `quart`
### _property_ `server_app`
`Quart` 对象
### _property_ `asgi`
`Quart` 对象
### _property_ `logger`
Quart 使用的 logger
### `on_startup(func)`
参考文档: [Startup and Shutdown](https://pgjones.gitlab.io/quart/how_to_guides/startup_shutdown.html)
### `on_shutdown(func)`
参考文档: [Startup and Shutdown](https://pgjones.gitlab.io/quart/how_to_guides/startup_shutdown.html)
### `run(host=None, port=None, *, app=None, **kwargs)`
使用 `uvicorn` 启动 Quart
## _class_ `WebSocket`
基类:[`nonebot.drivers.WebSocket`](README.md#nonebot.drivers.WebSocket)

View File

@ -1,245 +0,0 @@
# NoneBot.exception 模块
## 异常
下列文档中的异常是所有 NoneBot 运行时可能会抛出的。
这些异常并非所有需要用户处理,在 NoneBot 内部运行时被捕获,并进行对应操作。
## _exception_ `NoneBotException`
基类:`Exception`
* **说明**
所有 NoneBot 发生的异常基类。
## _exception_ `ParserExit`
基类:`nonebot.exception.NoneBotException`
* **说明**
`shell command` 处理消息失败时返回的异常
* **参数**
* `status`
* `message`
## _exception_ `ProcessException`
基类:`nonebot.exception.NoneBotException`
* **说明**
事件处理过程中发生的异常基类。
## _exception_ `IgnoredException`
基类:`nonebot.exception.ProcessException`
* **说明**
指示 NoneBot 应该忽略该事件。可由 PreProcessor 抛出。
* **参数**
* `reason`: 忽略事件的原因
## _exception_ `MockApiException`
基类:`nonebot.exception.ProcessException`
* **说明**
指示 NoneBot 阻止本次 API 调用或修改本次调用返回值,并返回自定义内容。可由 api hook 抛出。
* **参数**
* `result`: 返回的内容
## _exception_ `StopPropagation`
基类:`nonebot.exception.ProcessException`
* **说明**
指示 NoneBot 终止事件向下层传播。
* **用法**
`Matcher.block == True` 时抛出。
## _exception_ `MatcherException`
基类:`nonebot.exception.NoneBotException`
* **说明**
所有 Matcher 发生的异常基类。
## _exception_ `SkippedException`
基类:`nonebot.exception.MatcherException`
* **说明**
指示 NoneBot 立即结束当前 `Handler` 的处理,继续处理下一个 `Handler`
* **用法**
可以在 `Handler` 中通过 `Matcher.skip()` 抛出。
## _exception_ `PausedException`
基类:`nonebot.exception.MatcherException`
* **说明**
指示 NoneBot 结束当前 `Handler` 并等待下一条消息后继续下一个 `Handler`
可用于用户输入新信息。
* **用法**
可以在 `Handler` 中通过 `Matcher.pause()` 抛出。
## _exception_ `RejectedException`
基类:`nonebot.exception.MatcherException`
* **说明**
指示 NoneBot 结束当前 `Handler` 并等待下一条消息后重新运行当前 `Handler`
可用于用户重新输入。
* **用法**
可以在 `Handler` 中通过 `Matcher.reject()` 抛出。
## _exception_ `FinishedException`
基类:`nonebot.exception.MatcherException`
* **说明**
指示 NoneBot 结束当前 `Handler` 且后续 `Handler` 不再被运行。
可用于结束用户会话。
* **用法**
可以在 `Handler` 中通过 `Matcher.finish()` 抛出。
## _exception_ `AdapterException`
基类:`nonebot.exception.NoneBotException`
* **说明**
代表 `Adapter` 抛出的异常,所有的 `Adapter` 都要在内部继承自这个 `Exception`
* **参数**
* `adapter_name: str`: 标识 adapter
## _exception_ `NoLogException`
基类:`nonebot.exception.AdapterException`
* **说明**
指示 NoneBot 对当前 `Event` 进行处理但不显示 Log 信息,可在 `get_log_string` 时抛出
## _exception_ `ApiNotAvailable`
基类:`nonebot.exception.AdapterException`
* **说明**
在 API 连接不可用时抛出。
## _exception_ `NetworkError`
基类:`nonebot.exception.AdapterException`
* **说明**
在网络出现问题时抛出,如: API 请求地址不正确, API 请求无返回或返回状态非正常等。
## _exception_ `ActionFailed`
基类:`nonebot.exception.AdapterException`
* **说明**
API 请求成功返回数据,但 API 操作失败。

View File

@ -1,96 +0,0 @@
# NoneBot.handler 模块
## 事件处理函数
该模块实现事件处理函数的封装,以实现动态参数等功能。
## _class_ `Handler`
基类:`object`
事件处理器类。支持依赖注入。
### `__init__(func, *, name=None, dependencies=None, allow_types=None)`
* **说明**
装饰一个函数为事件处理器。
* **参数**
* `func: Callable[..., Any]`: 事件处理函数。
* `name: Optional[str]`: 事件处理器名称。默认为函数名。
* `dependencies: Optional[List[DependsWrapper]]`: 额外的非参数依赖注入。
* `allow_types: Optional[List[Type[Param]]]`: 允许的参数类型。
### `func`
* **类型**
`Callable[..., Any]`
* **说明**
事件处理函数
### `name`
* **类型**
`str`
* **说明**
事件处理函数名
### `allow_types`
* **类型**
`List[Type[Param]]`
* **说明**
事件处理器允许的参数类型
### `dependencies`
* **类型**
`List[DependsWrapper]`
* **说明**
事件处理器的额外依赖

View File

@ -1,37 +0,0 @@
# NoneBot.log 模块
## 日志
NoneBot 使用 [loguru](https://github.com/Delgan/loguru) 来记录日志信息。
自定义 logger 请参考 [loguru](https://github.com/Delgan/loguru) 文档。
## `logger`
* **说明**
NoneBot 日志记录器对象。
* **默认信息**
* 格式: `[%(asctime)s %(name)s] %(levelname)s: %(message)s`
* 等级: `DEBUG` / `INFO` ,根据 config 配置改变
* 输出: 输出至 stdout
* **用法**
```python
from nonebot.log import logger
```

View File

@ -1,584 +0,0 @@
# NoneBot.matcher 模块
## 事件响应器
该模块实现事件响应器的创建与运行,并提供一些快捷方法来帮助用户更好的与机器人进行对话 。
## `matchers`
* **类型**
`Dict[int, List[Type[Matcher]]]`
* **说明**
用于存储当前所有的事件响应器
## _class_ `Matcher`
基类:`object`
事件响应器类
### `plugin`
* **类型**
`Optional[Plugin]`
* **说明**
事件响应器所在插件
### `module`
* **类型**
`Optional[ModuleType]`
* **说明**
事件响应器所在插件模块
### `plugin_name`
* **类型**
`Optional[str]`
* **说明**
事件响应器所在插件名
### `module_name`
* **类型**
`Optional[str]`
* **说明**
事件响应器所在点分割插件模块路径
### `type`
* **类型**
`str`
* **说明**
事件响应器类型
### `rule`
* **类型**
`Rule`
* **说明**
事件响应器匹配规则
### `permission`
* **类型**
`Permission`
* **说明**
事件响应器触发权限
### `priority`
* **类型**
`int`
* **说明**
事件响应器优先级
### `block`
* **类型**
`bool`
* **说明**
事件响应器是否阻止事件传播
### `temp`
* **类型**
`bool`
* **说明**
事件响应器是否为临时
### `expire_time`
* **类型**
`Optional[datetime]`
* **说明**
事件响应器过期时间点
### `_default_state`
* **类型**
`T_State`
* **说明**
事件响应器默认状态
### `_default_state_factory`
* **类型**
`Optional[T_State]`
* **说明**
事件响应器默认工厂函数
### `_default_parser`
* **类型**
`Optional[T_ArgsParser]`
* **说明**
事件响应器默认参数解析函数
### `_default_type_updater`
* **类型**
`Optional[T_TypeUpdater]`
* **说明**
事件响应器类型更新函数
### `_default_permission_updater`
* **类型**
`Optional[T_PermissionUpdater]`
* **说明**
事件响应器权限更新函数
### `__init__()`
实例化 Matcher 以便运行
### `handlers`
* **类型**
`List[Handler]`
* **说明**
事件响应器拥有的事件处理函数列表
### _classmethod_ `new(type_='', rule=None, permission=None, handlers=None, temp=False, priority=1, block=False, *, plugin=None, module=None, expire_time=None, default_state=None, default_state_factory=None, default_parser=None, default_type_updater=None, default_permission_updater=None)`
* **说明**
创建一个新的事件响应器,并存储至 [matchers](#matchers)
* **参数**
* `type_: str`: 事件响应器类型,与 `event.get_type()` 一致时触发,空字符串表示任意
* `rule: Optional[Rule]`: 匹配规则
* `permission: Optional[Permission]`: 权限
* `handlers: Optional[List[T_Handler]]`: 事件处理函数列表
* `temp: bool`: 是否为临时事件响应器,即触发一次后删除
* `priority: int`: 响应优先级
* `block: bool`: 是否阻止事件向更低优先级的响应器传播
* `plugin: Optional[Plugin]`: 事件响应器所在插件
* `module: Optional[ModuleType]`: 事件响应器所在模块
* `default_state: Optional[T_State]`: 默认状态 `state`
* `default_state_factory: Optional[T_StateFactory]`: 默认状态 `state` 的工厂函数
* `expire_time: Optional[datetime]`: 事件响应器最终有效时间点,过时即被删除
* **返回**
* `Type[Matcher]`: 新的事件响应器类
### _async classmethod_ `check_perm(bot, event, stack=None, dependency_cache=None)`
* **说明**
检查是否满足触发权限
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: 上报事件
* **返回**
* `bool`: 是否满足权限
### _async classmethod_ `check_rule(bot, event, state, stack=None, dependency_cache=None)`
* **说明**
检查是否满足匹配规则
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: 上报事件
* `state: T_State`: 当前状态
* **返回**
* `bool`: 是否满足匹配规则
### _classmethod_ `args_parser(func)`
* **说明**
装饰一个函数来更改当前事件响应器的默认参数解析函数
* **参数**
* `func: T_ArgsParser`: 参数解析函数
### _classmethod_ `type_updater(func)`
* **说明**
装饰一个函数来更改当前事件响应器的默认响应事件类型更新函数
* **参数**
* `func: T_TypeUpdater`: 响应事件类型更新函数
### _classmethod_ `permission_updater(func)`
* **说明**
装饰一个函数来更改当前事件响应器的默认会话权限更新函数
* **参数**
* `func: T_PermissionUpdater`: 会话权限更新函数
### _classmethod_ `handle()`
* **说明**
装饰一个函数来向事件响应器直接添加一个处理函数
* **参数**
* 无
### _classmethod_ `receive()`
* **说明**
装饰一个函数来指示 NoneBot 在接收用户新的一条消息后继续运行该函数
* **参数**
* 无
### _classmethod_ `got(key, prompt=None, args_parser=None)`
* **说明**
装饰一个函数来指示 NoneBot 当要获取的 `key` 不存在时接收用户新的一条消息并经过 `ArgsParser` 处理后再运行该函数,如果 `key` 已存在则直接继续运行
* **参数**
* `key: str`: 参数名
* `prompt: Optional[Union[str, Message, MessageSegment, MessageFormatter]]`: 在参数不存在时向用户发送的消息
* `args_parser: Optional[T_ArgsParser]`: 可选参数解析函数,空则使用默认解析函数
### _async classmethod_ `send(message, **kwargs)`
* **说明**
发送一条消息给当前交互用户
* **参数**
* `message: Union[str, Message, MessageSegment]`: 消息内容
* `**kwargs`: 其他传递给 `bot.send` 的参数,请参考对应 adapter 的 bot 对象 api
### _async classmethod_ `finish(message=None, **kwargs)`
* **说明**
发送一条消息给当前交互用户并结束当前事件响应器
* **参数**
* `message: Union[str, Message, MessageSegment]`: 消息内容
* `**kwargs`: 其他传递给 `bot.send` 的参数,请参考对应 adapter 的 bot 对象 api
### _async classmethod_ `pause(prompt=None, **kwargs)`
* **说明**
发送一条消息给当前交互用户并暂停事件响应器,在接收用户新的一条消息后继续下一个处理函数
* **参数**
* `prompt: Union[str, Message, MessageSegment]`: 消息内容
* `**kwargs`: 其他传递给 `bot.send` 的参数,请参考对应 adapter 的 bot 对象 api
### _async classmethod_ `reject(prompt=None, **kwargs)`
* **说明**
发送一条消息给当前交互用户并暂停事件响应器,在接收用户新的一条消息后重新运行当前处理函数
* **参数**
* `prompt: Union[str, Message, MessageSegment]`: 消息内容
* `**kwargs`: 其他传递给 `bot.send` 的参数,请参考对应 adapter 的 bot 对象 api
### `stop_propagation()`
* **说明**
阻止事件传播

View File

@ -1,69 +0,0 @@
# NoneBot.message 模块
## 事件处理
NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供了多个插槽以进行事件的预处理等。
## `event_preprocessor(func)`
* **说明**
事件预处理。装饰一个函数,使它在每次接收到事件并分发给各响应器之前执行。
## `event_postprocessor(func)`
* **说明**
事件后处理。装饰一个函数,使它在每次接收到事件并分发给各响应器之后执行。
## `run_preprocessor(func)`
* **说明**
运行预处理。装饰一个函数,使它在每次事件响应器运行前执行。
## `run_postprocessor(func)`
* **说明**
运行后处理。装饰一个函数,使它在每次事件响应器运行后执行。
## _async_ `handle_event(bot, event)`
* **说明**
处理一个事件。调用该函数以实现分发事件。
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: Event 对象
* **示例**
```python
import asyncio
asyncio.create_task(handle_event(bot, event))
```

View File

@ -1,319 +0,0 @@
# NoneBot 模块
## 快捷导入
为方便使用,`nonebot` 模块从子模块导入了部分内容
* `on_message` => `nonebot.plugin.on_message`
* `on_notice` => `nonebot.plugin.on_notice`
* `on_request` => `nonebot.plugin.on_request`
* `on_metaevent` => `nonebot.plugin.on_metaevent`
* `on_startswith` => `nonebot.plugin.on_startswith`
* `on_endswith` => `nonebot.plugin.on_endswith`
* `on_keyword` => `nonebot.plugin.on_keyword`
* `on_command` => `nonebot.plugin.on_command`
* `on_shell_command` => `nonebot.plugin.on_shell_command`
* `on_regex` => `nonebot.plugin.on_regex`
* `CommandGroup` => `nonebot.plugin.CommandGroup`
* `Matchergroup` => `nonebot.plugin.MatcherGroup`
* `load_plugin` => `nonebot.plugin.load_plugin`
* `load_plugins` => `nonebot.plugin.load_plugins`
* `load_all_plugins` => `nonebot.plugin.load_all_plugins`
* `load_from_json` => `nonebot.plugin.load_from_json`
* `load_from_toml` => `nonebot.plugin.load_from_toml`
* `load_builtin_plugins` => `nonebot.plugin.load_builtin_plugins`
* `get_plugin` => `nonebot.plugin.get_plugin`
* `get_loaded_plugins` => `nonebot.plugin.get_loaded_plugins`
* `export` => `nonebot.plugin.export`
* `require` => `nonebot.plugin.require`
## `get_driver()`
* **说明**
获取全局 Driver 对象。可用于在计划任务的回调中获取当前 Driver 对象。
* **返回**
* `Driver`: 全局 Driver 对象
* **异常**
* `ValueError`: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
* **用法**
```python
driver = nonebot.get_driver()
```
## `get_app()`
* **说明**
获取全局 Driver 对应 Server App 对象。
* **返回**
* `Any`: Server App 对象
* **异常**
* `ValueError`: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
* **用法**
```python
app = nonebot.get_app()
```
## `get_asgi()`
* **说明**
获取全局 Driver 对应 Asgi 对象。
* **返回**
* `Any`: Asgi 对象
* **异常**
* `ValueError`: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
* **用法**
```python
asgi = nonebot.get_asgi()
```
## `get_bot(self_id=None)`
* **说明**
当提供 self_id 时,此函数是 get_bots()[self_id] 的简写;当不提供时,返回一个 Bot。
* **参数**
* `self_id: Optional[str]`: 用来识别 Bot 的 ID
* **返回**
* `Bot`: Bot 对象
* **异常**
* `KeyError`: 对应 ID 的 Bot 不存在
* `ValueError`: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
* `ValueError`: 没有传入 ID 且没有 Bot 可用
* **用法**
```python
assert nonebot.get_bot('12345') == nonebot.get_bots()['12345']
another_unspecified_bot = nonebot.get_bot()
```
## `get_bots()`
* **说明**
获取所有通过 ws 连接 NoneBot 的 Bot 对象。
* **返回**
* `Dict[str, Bot]`: 一个以字符串 ID 为键Bot 对象为值的字典
* **异常**
* `ValueError`: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
* **用法**
```python
bots = nonebot.get_bots()
```
## `init(*, _env_file=None, **kwargs)`
* **说明**
初始化 NoneBot 以及 全局 Driver 对象。
NoneBot 将会从 .env 文件中读取环境信息,并使用相应的 env 文件配置。
你也可以传入自定义的 _env_file 来指定 NoneBot 从该文件读取配置。
* **参数**
* `_env_file: Optional[str]`: 配置文件名,默认从 .env.{env_name} 中读取配置
* `**kwargs`: 任意变量,将会存储到 Config 对象里
* **返回**
* `None`
* **用法**
```python
nonebot.init(database=Database(...))
```
## `run(host=None, port=None, *args, **kwargs)`
* **说明**
启动 NoneBot即运行全局 Driver 对象。
* **参数**
* `host: Optional[str]`: 主机名IP若不传入则使用配置文件中指定的值
* `port: Optional[int]`: 端口,若不传入则使用配置文件中指定的值
* `*args`: 传入 Driver.run 的位置参数
* `**kwargs`: 传入 Driver.run 的命名参数
* **返回**
* `None`
* **用法**
```python
nonebot.run(host="127.0.0.1", port=8080)
```

View File

@ -1,138 +0,0 @@
# NoneBot.permission 模块
## 权限
每个 `Matcher` 拥有一个 `Permission` ,其中是 `PermissionChecker` 的集合,只要有一个 `PermissionChecker` 检查结果为 `True` 时就会继续运行。
:::tip 提示
`PermissionChecker` 既可以是 async function 也可以是 sync function
:::
## _class_ `Permission`
基类:`object`
* **说明**
`Matcher` 规则类,当事件传递时,在 `Matcher` 运行前进行检查。
* **示例**
```python
Permission(async_function) | sync_function
# 等价于
from nonebot.utils import run_sync
Permission(async_function, run_sync(sync_function))
```
### `__init__(*checkers)`
* **参数**
* `*checkers: Union[T_PermissionChecker, Handler]`: PermissionChecker
### `checkers`
* **说明**
存储 `PermissionChecker`
* **类型**
* `Set[Handler]`
### _async_ `__call__(bot, event, stack=None, dependency_cache=None)`
* **说明**
检查是否满足某个权限
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: Event 对象
* `stack: Optional[AsyncExitStack]`: 异步上下文栈
* `dependency_cache: Optional[Dict[Callable[..., Any], Any]]`: 依赖缓存
* **返回**
* `bool`
## `MESSAGE`
* **说明**: 匹配任意 `message` 类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 message type 的 Matcher。
## `NOTICE`
* **说明**: 匹配任意 `notice` 类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 notice type 的 Matcher。
## `REQUEST`
* **说明**: 匹配任意 `request` 类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 request type 的 Matcher。
## `METAEVENT`
* **说明**: 匹配任意 `meta_event` 类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 meta_event type 的 Matcher。
## `USER(*user, perm=None)`
* **说明**
`event``session_id` 在白名单内且满足 perm
* **参数**
* `*user: str`: 白名单
* `perm: Optional[Permission]`: 需要同时满足的权限
## `SUPERUSER`
* **说明**: 匹配任意超级用户消息类型事件

File diff suppressed because it is too large Load Diff

View File

@ -1,267 +0,0 @@
# NoneBot.rule 模块
## 规则
每个事件响应器 `Matcher` 拥有一个匹配规则 `Rule` ,其中是 `RuleChecker` 的集合,只有当所有 `RuleChecker` 检查结果为 `True` 时继续运行。
:::tip 提示
`RuleChecker` 既可以是 async function 也可以是 sync function
:::
## _class_ `Rule`
基类:`object`
* **说明**
`Matcher` 规则类,当事件传递时,在 `Matcher` 运行前进行检查。
* **示例**
```python
Rule(async_function) & sync_function
# 等价于
from nonebot.utils import run_sync
Rule(async_function, run_sync(sync_function))
```
### `__init__(*checkers)`
* **参数**
* `*checkers: Union[T_RuleChecker, Handler]`: RuleChecker
### `checkers`
* **说明**
存储 `RuleChecker`
* **类型**
* `Set[Handler]`
### _async_ `__call__(bot, event, state, stack=None, dependency_cache=None)`
* **说明**
检查是否符合所有规则
* **参数**
* `bot: Bot`: Bot 对象
* `event: Event`: Event 对象
* `state: T_State`: 当前 State
* `stack: Optional[AsyncExitStack]`: 异步上下文栈
* `dependency_cache: Optional[Dict[Callable[..., Any], Any]]`: 依赖缓存
* **返回**
* `bool`
## `startswith(msg, ignorecase=False)`
* **说明**
匹配消息开头
* **参数**
* `msg: str`: 消息开头字符串
## `endswith(msg, ignorecase=False)`
* **说明**
匹配消息结尾
* **参数**
* `msg: str`: 消息结尾字符串
## `keyword(*keywords)`
* **说明**
匹配消息关键词
* **参数**
* `*keywords: str`: 关键词
## `command(*cmds)`
* **说明**
命令形式匹配,根据配置里提供的 `command_start`, `command_sep` 判断消息是否为命令。
可以通过 `state["_prefix"]["command"]` 获取匹配成功的命令(例:`("test",)`),通过 `state["_prefix"]["raw_command"]` 获取匹配成功的原始命令文本(例:`"/test"`)。
* **参数**
* `*cmds: Union[str, Tuple[str, ...]]`: 命令内容
* **示例**
使用默认 `command_start`, `command_sep` 配置
命令 `("test",)` 可以匹配:`/test` 开头的消息
命令 `("test", "sub")` 可以匹配”`/test.sub` 开头的消息
:::tip 提示
命令内容与后续消息间无需空格!
:::
## _class_ `ArgumentParser`
基类:`argparse.ArgumentParser`
* **说明**
`shell_like` 命令参数解析器,解析出错时不会退出程序。
## `shell_command(*cmds, parser=None)`
* **说明**
支持 `shell_like` 解析参数的命令形式匹配,根据配置里提供的 `command_start`, `command_sep` 判断消息是否为命令。
可以通过 `state["_prefix"]["command"]` 获取匹配成功的命令(例:`("test",)`),通过 `state["_prefix"]["raw_command"]` 获取匹配成功的原始命令文本(例:`"/test"`)。
可以通过 `state["argv"]` 获取用户输入的原始参数列表
添加 `parser` 参数后, 可以自动处理消息并将结果保存在 `state["args"]` 中。
* **参数**
* `*cmds: Union[str, Tuple[str, ...]]`: 命令内容
* `parser: Optional[ArgumentParser]`: `nonebot.rule.ArgumentParser` 对象
* **示例**
使用默认 `command_start`, `command_sep` 配置,更多示例参考 `argparse` 标准库文档。
```python
from nonebot.rule import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-a", action="store_true")
rule = shell_command("ls", parser=parser)
```
:::tip 提示
命令内容与后续消息间无需空格!
:::
## `regex(regex, flags=0)`
* **说明**
根据正则表达式进行匹配。
可以通过 `state["_matched"]` `state["_matched_groups"]` `state["_matched_dict"]`
获取正则表达式匹配成功的文本。
* **参数**
* `regex: str`: 正则表达式
* `flags: Union[int, re.RegexFlag]`: 正则标志
:::tip 提示
正则表达式匹配使用 search 而非 match如需从头匹配请使用 `r"^xxx"` 来确保匹配开头
:::
## `to_me()`
* **说明**
通过 `event.is_tome()` 判断事件是否与机器人有关
* **参数**
* 无

View File

@ -1,363 +0,0 @@
# NoneBot.typing 模块
## 类型
下面的文档中,「类型」部分使用 Python 的 Type Hint 语法,见 [PEP 484](https://www.python.org/dev/peps/pep-0484/)、[PEP 526](https://www.python.org/dev/peps/pep-0526/) 和 [typing](https://docs.python.org/3/library/typing.html)。
除了 Python 内置的类型,下面还出现了如下 NoneBot 自定类型,实际上它们是 Python 内置类型的别名。
以下类型均可从 nonebot.typing 模块导入。
## `T_State`
* **类型**
`Dict[Any, Any]`
* **说明**
事件处理状态 State 类型
## `T_StateFactory`
* **类型**
`Callable[[Bot, Event], Awaitable[T_State]]`
* **说明**
事件处理状态 State 类工厂函数
## `T_BotConnectionHook`
* **类型**
`Callable[[Bot], Awaitable[None]]`
* **说明**
Bot 连接建立时执行的函数
## `T_BotDisconnectionHook`
* **类型**
`Callable[[Bot], Awaitable[None]]`
* **说明**
Bot 连接断开时执行的函数
## `T_CallingAPIHook`
* **类型**
`Callable[[Bot, str, Dict[str, Any]], Awaitable[None]]`
* **说明**
`bot.call_api` 时执行的函数
## `T_CalledAPIHook`
* **类型**
`Callable[[Bot, Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]]`
* **说明**
`bot.call_api` 后执行的函数,参数分别为 bot, exception, api, data, result
## `T_EventPreProcessor`
* **类型**
`Callable[..., Union[None, Awaitable[None]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* `StateParam`: State 对象
* **说明**
事件预处理函数 EventPreProcessor 类型
## `T_EventPostProcessor`
* **类型**
`Callable[..., Union[None, Awaitable[None]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* `StateParam`: State 对象
* **说明**
事件预处理函数 EventPostProcessor 类型
## `T_RunPreProcessor`
* **类型**
`Callable[..., Union[None, Awaitable[None]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* `StateParam`: State 对象
* `MatcherParam`: Matcher 对象
* **说明**
事件响应器运行前预处理函数 RunPreProcessor 类型
## `T_RunPostProcessor`
* **类型**
`Callable[..., Union[None, Awaitable[None]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* `StateParam`: State 对象
* `MatcherParam`: Matcher 对象
* `ExceptionParam`: 异常对象(可能为 None
* **说明**
事件响应器运行前预处理函数 RunPostProcessor 类型,第二个参数为运行时产生的错误(如果存在)
## `T_RuleChecker`
* **类型**
`Callable[..., Union[bool, Awaitable[bool]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* `StateParam`: State 对象
* **说明**
RuleChecker 即判断是否响应事件的处理函数。
## `T_PermissionChecker`
* **类型**
`Callable[..., Union[bool, Awaitable[bool]]]`
* **依赖参数**
* `BotParam`: Bot 对象
* `EventParam`: Event 对象
* **说明**
RuleChecker 即判断是否响应消息的处理函数。
## `T_Handler`
* **类型**
`Callable[..., Any]`
* **说明**
Handler 处理函数。
## `T_DependencyCache`
* **类型**
`Dict[T_Handler, Any]`
* **说明**
依赖缓存, 用于存储依赖函数的返回值
## `T_ArgsParser`
* **类型**
`Callable[[Bot, Event, T_State], Union[Awaitable[None], Awaitable[NoReturn]]]`
* **说明**
ArgsParser 即消息参数解析函数,在 Matcher.got 获取参数时被运行。
## `T_TypeUpdater`
* **类型**
`Callable[[Bot, Event, T_State, str], Awaitable[str]]`
* **说明**
TypeUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新响应的事件类型。默认会更新为 `message`
## `T_PermissionUpdater`
* **类型**
`Callable[[Bot, Event, T_State, Permission], Awaitable[Permission]]`
* **说明**
PermissionUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新会话对象权限。默认会更新为当前事件的触发对象。

View File

@ -1,80 +0,0 @@
# NoneBot.utils 模块
## `escape_tag(s)`
* **说明**
用于记录带颜色日志时转义 `<tag>` 类型特殊标签
* **参数**
* `s: str`: 需要转义的字符串
* **返回**
* `str`
## `run_sync(func)`
* **说明**
一个用于包装 sync function 为 async function 的装饰器
* **参数**
* `func: Callable[P, R]`: 被装饰的同步函数
* **返回**
* `Callable[P, Awaitable[R]]`
## _class_ `DataclassEncoder`
基类:`json.encoder.JSONEncoder`
* **说明**
在JSON序列化 `Message` (List[Dataclass]) 时使用的 `JSONEncoder`
## `logger_wrapper(logger_name)`
* **说明**
用于打印 adapter 的日志。
* **Log 参数**
* `level: Literal['WARNING', 'DEBUG', 'INFO']`: 日志等级
* `message: str`: 日志信息
* `exception: Optional[Exception]`: 异常信息

View File

@ -1,20 +1,16 @@
---
sidebar_position: 1
id: guide
id: index
slug: /guide
options:
menu:
weight: 10
catogory: guide
category: guide
---
# 概览
<!-- :::tip 提示
如果在阅读本文档时遇到难以理解的词汇,请随时查阅 [术语表](../glossary.md) 或使用 [Google 搜索](https://www.google.com/)。
::: -->
:::tip 提示
初次使用时可能会觉得这里的概览过于枯燥,可以先简单略读之后直接前往 [安装](./installation.md) 查看安装方法,并进行后续的基础使用教程。
:::

View File

@ -4,7 +4,7 @@ sidebar_position: 5
options:
menu:
weight: 50
catogory: guide
category: guide
---
# 基本配置

View File

@ -1,4 +0,0 @@
{
"label": "编写插件",
"position": 2
}

View File

@ -1,10 +1,10 @@
---
sidebar_position: 4
sidebar_position: 9
options:
menu:
weight: 140
catogory: guide
weight: 90
category: guide
---
# 事件处理
@ -122,8 +122,8 @@ async def handle(bot: Bot):
参数分别为:
1. [nonebot.adapters.Bot](../api/adapters/#class-bot): 即事件上报连接对应的 Bot 对象,为 BaseBot 的子类。特别注意,此处的类型注释可以替换为指定的 Bot 类型,例如:`nonebot.adapters.cqhttp.Bot`,只有在上报事件的 Bot 类型与类型注释相符时才会执行该处理函数!可用于多平台进行不同的处理。
2. [nonebot.adapters.Event](../api/adapters/#class-event): 即上报事件对象,可以获取到上报的所有信息。
1. [nonebot.adapters.Bot](../api/adapters/README.md#class-bot): 即事件上报连接对应的 Bot 对象,为 BaseBot 的子类。特别注意,此处的类型注释可以替换为指定的 Bot 类型,例如:`nonebot.adapters.cqhttp.Bot`,只有在上报事件的 Bot 类型与类型注释相符时才会执行该处理函数!可用于多平台进行不同的处理。
2. [nonebot.adapters.Event](../api/adapters/README.md#class-event): 即上报事件对象,可以获取到上报的所有信息。
3. [state](../api/typing.md#t-state): 状态字典,可以存储任意的信息,其中还包含一些特殊的值以获取 NoneBot 内部处理时的一些信息,如:
- `state["_current_key"]`: 存储当前 `got` 获取的参数名

View File

@ -1,10 +1,10 @@
---
sidebar_position: 3
sidebar_position: 8
options:
menu:
weight: 130
catogory: guide
weight: 80
category: guide
---
# 注册事件响应器
@ -50,7 +50,7 @@ async def get_weather(city: str):
从这里开始,你需要对 Python 的 asyncio 编程有所了解,因为 NoneBot 是完全基于 asyncio 的,具体可以参考 [廖雪峰的 Python 教程](https://www.liaoxuefeng.com/wiki/1016959663602400/1017959540289152)
:::
## [事件响应器](../../api/matcher.md)
## [事件响应器](../api/matcher.md)
```python{5}
from nonebot import on_command
@ -81,11 +81,11 @@ weather = on_command("天气", rule=to_me(), permission=Permission(), priority=5
- `on_message()` ~ `on("message")`: 消息事件响应器
- `on_request()` ~ `on("request")`: 请求事件响应器
- `on_notice()` ~ `on("notice")`: 通知事件响应器
- `on_startswith(str)` ~ `on("message", startswith(str))`: 消息开头匹配响应器,参考 [startswith](../../api/rule.md#startswith-msg)
- `on_endswith(str)` ~ `on("message", endswith(str))`: 消息结尾匹配响应器,参考 [endswith](../../api/rule.md#endswith-msg)
- `on_keyword(set)` ~ `on("message", keyword(str))`: 消息关键词匹配响应器,参考 [keyword](../../api/rule.md#keyword-keywords)
- `on_command(str|tuple)` ~ `on("message", command(str|tuple))`: 命令响应器,参考 [command](../../api/rule.md#command-cmds)
- `on_regex(pattern_str)` ~ `on("message", regex(pattern_str))`: 正则匹配处理器,参考 [regex](../../api/rule.md#regex-regex-flags-0)
- `on_startswith(str)` ~ `on("message", startswith(str))`: 消息开头匹配响应器,参考 [startswith](../api/rule.md#startswith-msg)
- `on_endswith(str)` ~ `on("message", endswith(str))`: 消息结尾匹配响应器,参考 [endswith](../api/rule.md#endswith-msg)
- `on_keyword(set)` ~ `on("message", keyword(str))`: 消息关键词匹配响应器,参考 [keyword](../api/rule.md#keyword-keywords)
- `on_command(str|tuple)` ~ `on("message", command(str|tuple))`: 命令响应器,参考 [command](../api/rule.md#command-cmds)
- `on_regex(pattern_str)` ~ `on("message", regex(pattern_str))`: 正则匹配处理器,参考 [regex](../api/rule.md#regex-regex-flags-0)
### 匹配规则 rule
@ -116,11 +116,11 @@ NoneBot 内置的事件响应器中,所有 `message` 类的事件响应器默
rule 的出现使得 nonebot 对事件的响应可以非常自由nonebot 内置了一些规则:
- [startswith(msg)](../../api/rule.md#startswith-msg)
- [endswith(msg)](../../api/rule.md#endswith-msg)
- [keyword(\*keywords)](../../api/rule.md#keyword-keywords)
- [command(\*cmds)](../../api/rule.md#command-cmds)
- [regex(regex, flag)](../../api/rule.md#regex-regex-flags-0)
- [startswith(msg)](../api/rule.md#startswith-msg)
- [endswith(msg)](../api/rule.md#endswith-msg)
- [keyword(\*keywords)](../api/rule.md#keyword-keywords)
- [command(\*cmds)](../api/rule.md#command-cmds)
- [regex(regex, flag)](../api/rule.md#regex-regex-flags-0)
以上规则都是返回类型为 `Rule` 的函数,`Rule` 由非负个 `RuleChecker` 组成,当所有 `RuleChecker` 返回 `True` 时匹配成功。这些 `Rule`, `RuleChecker` 的形式如下:

View File

@ -1,10 +1,10 @@
---
sidebar_position: 2
sidebar_position: 7
options:
menu:
weight: 120
catogory: guide
weight: 70
category: guide
---
# 创建插件

View File

@ -4,7 +4,7 @@ sidebar_position: 4
options:
menu:
weight: 40
catogory: guide
category: guide
---
# 创建一个完整的项目

View File

@ -99,4 +99,3 @@ async def feishu_helper(bot: FeishuBot, event: MessageEvent, state: T_State):
以上代码注册了一个对飞书平台适用的`say`指令,并会提取`/say`之后的内容发送到事件所对应的群或私聊。
大功告成!现在可以试试向机器人发送类似`/say Hello, Feishu!`的消息进行测试了。

View File

@ -4,7 +4,7 @@ sidebar_position: 3
options:
menu:
weight: 30
catogory: guide
category: guide
---
# 开始使用

View File

@ -4,7 +4,7 @@ sidebar_position: 2
options:
menu:
weight: 20
catogory: guide
category: guide
---
# 安装
@ -115,7 +115,7 @@ nb plugin install <plugin-name>
### 其他插件
还有更多的插件在 [这里](/store.html) 等着你发现~
还有更多的插件在 [这里](/store) 等着你发现~
## 安装开发环境(可选)

View File

@ -1,10 +1,10 @@
---
sidebar_position: 1
sidebar_position: 6
options:
menu:
weight: 110
catogory: guide
weight: 60
category: guide
---
# 加载插件
@ -42,7 +42,7 @@ if __name__ == "__main__":
- 命令 `say`:可由**superuser**使用,可以将消息内容由特殊纯文本转为富文本
- 命令 `echo`:可由任何人使用,将消息原样返回
以上命令均需要指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称。参考 [Rule: to_me](../../api/rule.md#to-me)
以上命令均需要指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称。参考 [Rule: to_me](../api/rule.md#to-me)
## 加载插件目录
@ -71,7 +71,7 @@ if __name__ == "__main__":
:::
:::danger 警告
插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以参考 [进阶-跨插件访问](../../advanced/export-and-require.md)
插件间不应该存在过多的耦合,如果确实需要导入某个插件内的数据,可以参考 [进阶-跨插件访问](../advanced/export-and-require.md)
:::
## 加载单个插件

View File

@ -133,11 +133,11 @@ pip install nonebot-adapter-mirai
from nonebot.adapters.mirai import Bot
nonebot.init()
nonebot.get_driver().register_adapter('mirai',
Bot,
nonebot.get_driver().register_adapter('mirai',
Bot,
qq=12345678)
# qq参数需要填在mah中登录的qq, 如果需要多个帐号, 可以填写类似于 [123456,789100] 的数组形式
nonebot.load_builtin_plugins() # 加载 nonebot 内置插件
nonebot.run()
```
@ -246,7 +246,7 @@ async def _echo(bot: Bot, event: MessageEvent):
它具有两种行为
- 在指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称的情况下 (即 [Rule: to_me](../api/rule.md#to-me)), 如果消息内包含 `reply` 字段, 则该消息会被机器人重复一次
- 在指定机器人,即私聊、群聊内@机器人、群聊内称呼机器人昵称的情况下 (即 [Rule: to_me](../api/rule.md#to_me)), 如果消息内包含 `reply` 字段, 则该消息会被机器人重复一次
- 在执行指令`miecho xxx`时, 机器人会发送回参数`xxx`

View File

@ -1,4 +0,0 @@
{
"label": "开始",
"position": 1
}

View File

@ -14,8 +14,64 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
guide: [{ type: "autogenerated", dirName: "guide" }],
advanced: [{ type: "autogenerated", dirName: "advanced" }],
guide: [
{
type: "category",
label: "开始",
collapsible: false,
items: [
"guide/index",
"guide/installation",
"guide/getting-started",
"guide/creating-a-project",
"guide/basic-configuration",
],
},
{
type: "category",
label: "编写插件",
collapsible: false,
items: [
"guide/loading-a-plugin",
"guide/creating-a-plugin",
"guide/creating-a-matcher",
"guide/creating-a-handler",
"guide/end-or-start",
],
},
{
type: "category",
label: "协议适配",
collapsible: false,
items: [
"guide/cqhttp-guide",
"guide/ding-guide",
"guide/mirai-guide",
"guide/feishu-guide",
],
},
],
advanced: [
{
type: "category",
label: "进阶",
collapsible: false,
items: [
"advanced/index",
"advanced/scheduler",
"advanced/permission",
"advanced/runtime-hook",
"advanced/export-and-require",
"advanced/overloaded-handlers",
],
},
{
type: "category",
label: "发布",
collapsible: false,
items: ["advanced/publish-plugin"],
},
],
api: [{ type: "autogenerated", dirName: "api" }],
// But you can create a sidebar manually

View File

@ -1553,10 +1553,10 @@
resolved "https://registry.nlark.com/@seznam/compose-react-refs/download/@seznam/compose-react-refs-1.0.6.tgz#6ec4e70bdd6e32f8e70b4100f27267cf306bd8df"
integrity sha1-bsTnC91uMvjnC0EA8nJnzzBr2N8=
"@sideway/address@^4.1.0":
version "4.1.2"
resolved "https://registry.nlark.com/@sideway/address/download/@sideway/address-4.1.2.tgz?cache=0&sync_timestamp=1620367945721&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40sideway%2Faddress%2Fdownload%2F%40sideway%2Faddress-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1"
integrity sha1-gRuEMzozVznTlpz8Q0c2JoFwytE=
"@sideway/address@^4.1.3":
version "4.1.3"
resolved "https://registry.npmmirror.com/@sideway/address/download/@sideway/address-4.1.3.tgz#d93cce5d45c5daec92ad76db492cc2ee3c64ab27"
integrity sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==
dependencies:
"@hapi/hoek" "^9.0.0"
@ -3230,20 +3230,20 @@ dns-txt@^2.0.2:
dependencies:
buffer-indexof "^1.0.0"
docusaurus-preset-nonepress@canary:
version "0.0.0-107"
resolved "https://registry.npmmirror.com/docusaurus-preset-nonepress/download/docusaurus-preset-nonepress-0.0.0-107.tgz#b9a1727f5452fc7d15d706aa9e07daf0079b665f"
integrity sha512-26xugwSdg3iIlzoNKOaw5aGAFVnyzAX23q7xTixzbYVtDXJc628trbm3kJ+YzatXaOz+LkItBrB3kqIQMK5UJw==
docusaurus-preset-nonepress@0.0.0-108, docusaurus-preset-nonepress@canary:
version "0.0.0-108"
resolved "https://registry.npmmirror.com/docusaurus-preset-nonepress/download/docusaurus-preset-nonepress-0.0.0-108.tgz#37a4068c71fe335d2486d9effcadcb18503b50cb"
integrity sha512-GuH22RrrI5FWiUPIKEWWisWJ/laymWMY+aFbfXY5fNLzarLFkAmshUpGHuuAMAnL/U1W812RYyJNoNHnUA/XgQ==
dependencies:
"@docusaurus/core" "2.0.0-beta.9"
"@docusaurus/plugin-content-docs" "2.0.0-beta.9"
"@docusaurus/plugin-content-pages" "2.0.0-beta.9"
docusaurus-theme-nonepress "0.0.0-107"
docusaurus-theme-nonepress "0.0.0-108"
docusaurus-theme-nonepress@0.0.0-107:
version "0.0.0-107"
resolved "https://registry.npmmirror.com/docusaurus-theme-nonepress/download/docusaurus-theme-nonepress-0.0.0-107.tgz#bc9a4ee894f7162848e71abebca9ce2aad61378f"
integrity sha512-ShYfDCHLP/g+RIMB+ET89u9/43EwUvuSeuHwsr1dvxSn/yebiw4K5ZBFZOaJLw0ftcFolgqt2tJL5i5DagQLNg==
docusaurus-theme-nonepress@0.0.0-108:
version "0.0.0-108"
resolved "https://registry.npmmirror.com/docusaurus-theme-nonepress/download/docusaurus-theme-nonepress-0.0.0-108.tgz#d1e381a446d1179841ae4fe5f51cd6314df9b0a1"
integrity sha512-PSawVRZFvn6kBKBsiET7Ihs98jRxnq+Mg9J6KRTTGdJBOyUCBd/9E1oE2YF9VaQGil0NbhuM7Avysri4YP3meA==
dependencies:
"@docsearch/react" "^3.0.0-alpha.39"
"@docusaurus/core" "2.0.0-beta.9"
@ -3392,9 +3392,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.896:
version "1.4.6"
resolved "https://registry.npmmirror.com/electron-to-chromium/download/electron-to-chromium-1.4.6.tgz#7bf0c03001bcdbd0fc57a45c6b23bc6432246ade"
integrity sha512-YDZAXP0P8USm0YoyIXWijxFT3tJHbt3WwY7CTQiK3+Ad6Ai/b9N4GqfDR107jfGilAfxl7Gkhb+h0KPoKXAgqw==
version "1.4.7"
resolved "https://registry.npmmirror.com/electron-to-chromium/download/electron-to-chromium-1.4.7.tgz#58e0b4ec9096ee1422e4d9e83ceeb05b0cf076eb"
integrity sha512-UPy2MsQw1OdcbxR7fvwWZH/rXcv+V26+uvQVHx0fGa1kqRfydtfOw+NMGAvZJ63hyaH4aEBxbhSEtqbpliSNWA==
emoji-regex@^8.0.0:
version "8.0.0"
@ -4721,13 +4721,13 @@ jest-worker@^27.0.2, jest-worker@^27.0.6:
supports-color "^8.0.0"
joi@^17.4.0, joi@^17.4.2:
version "17.4.2"
resolved "https://registry.nlark.com/joi/download/joi-17.4.2.tgz#02f4eb5cf88e515e614830239379dcbbe28ce7f7"
integrity sha1-AvTrXPiOUV5hSDAjk3ncu+KM5/c=
version "17.4.3"
resolved "https://registry.npmmirror.com/joi/download/joi-17.4.3.tgz#462941fd994f11fcb92f59ba9f004706b9a45d17"
integrity sha512-8W3oOogFRuy2aLAdlhMpzS4fNBIMiyIa3xBaBYMFgA272/d5sob1DAth6jjo+5VrOlzbEgmbBGbU4cLrffPKog==
dependencies:
"@hapi/hoek" "^9.0.0"
"@hapi/topo" "^5.0.0"
"@sideway/address" "^4.1.0"
"@sideway/address" "^4.1.3"
"@sideway/formula" "^3.0.0"
"@sideway/pinpoint" "^2.0.0"
@ -5148,11 +5148,6 @@ mime@1.6.0:
resolved "https://registry.npmmirror.com/mime/download/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE=
mime@^2.3.1:
version "2.6.0"
resolved "https://registry.npmmirror.com/mime/download/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367"
integrity sha1-oqaCqVzU0MsdYlfij4PafjWAA2c=
mimic-fn@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
@ -5204,6 +5199,11 @@ mkdirp@^0.5.5, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.5"
mrmime@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/mrmime/download/mrmime-1.0.0.tgz#14d387f0585a5233d291baba339b063752a2398b"
integrity sha1-FNOH8FhaUjPSkbq6M5sGN1KiOYs=
ms@2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/ms/download/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@ -5996,6 +5996,11 @@ prepend-http@^2.0.0:
resolved "https://registry.nlark.com/prepend-http/download/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier@^2.5.0:
version "2.5.0"
resolved "https://registry.npmmirror.com/prettier/download/prettier-2.5.0.tgz#a6370e2d4594e093270419d9cc47f7670488f893"
integrity sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==
pretty-error@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/pretty-error/download/pretty-error-4.0.0.tgz#90a703f46dd7234adb46d0f84823e9d1cb8f10d6"
@ -6829,12 +6834,12 @@ signal-exit@^3.0.2, signal-exit@^3.0.3:
integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==
sirv@^1.0.7:
version "1.0.18"
resolved "https://registry.npmmirror.com/sirv/download/sirv-1.0.18.tgz#105fab52fb656ce8a2bebbf36b11052005952899"
integrity sha1-EF+rUvtlbOiivrvzaxEFIAWVKJk=
version "1.0.19"
resolved "https://registry.npmmirror.com/sirv/download/sirv-1.0.19.tgz#1d73979b38c7fe91fcba49c85280daa9c2363b49"
integrity sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==
dependencies:
"@polka/url" "^1.0.0-next.20"
mime "^2.3.1"
mrmime "^1.0.0"
totalist "^1.0.0"
sisteransi@^1.0.5: