mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-10-08 19:56:45 +00:00
Compare commits
116 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
033c90dd74 | ||
|
762b2e6ef1 | ||
|
3e3f504c1c | ||
|
8f8ce4b853 | ||
|
18b6151c91 | ||
|
0f552743df | ||
|
fdc9c6f056 | ||
|
16812e3621 | ||
|
17c3c09d86 | ||
|
f7fe9fba5c | ||
|
cc4d0b61f0 | ||
|
19d9014279 | ||
|
a63322633a | ||
|
5ddb9b295d | ||
|
2d4379fcfa | ||
|
227fb3b667 | ||
|
faba8aae4e | ||
|
852f033769 | ||
|
4975f4a0c8 | ||
|
93eb6cae93 | ||
|
dea43fb1ef | ||
|
dc83031589 | ||
|
ebb4ca4dba | ||
|
25fc7a7449 | ||
|
f4f72dc2b3 | ||
|
ac9ee830c6 | ||
|
73710aa311 | ||
|
b8c4898eff | ||
|
9189711c0a | ||
|
2d4c2e472b | ||
|
34427f0dd2 | ||
|
4f7d3965d4 | ||
|
64ce1a64d9 | ||
|
ca79f29c60 | ||
|
d5cd6427b9 | ||
|
aa00ccf3be | ||
|
3997c09c34 | ||
|
4a06576c5e | ||
|
67bca08ee2 | ||
|
867766b469 | ||
|
1175a4452e | ||
|
208533f5ca | ||
|
4a6428100b | ||
|
32bc2c314a | ||
|
ab8dea5a02 | ||
|
e06076aa3a | ||
|
36d90c0efd | ||
|
0fbfa20257 | ||
|
6c0d5f3e1d | ||
|
0b72c765a7 | ||
|
21815b380f | ||
|
9fed938de1 | ||
|
6df8d5b254 | ||
|
aedc541d03 | ||
|
bdf8dff08e | ||
|
081dc8352d | ||
|
6dad4d2a74 | ||
|
3528339751 | ||
|
efae3c8756 | ||
|
3aa1bc7b66 | ||
|
f6027bbcd9 | ||
|
1dec074232 | ||
|
76a455227d | ||
|
b33845b936 | ||
|
56f1927376 | ||
|
232b7134f0 | ||
|
980affd31b | ||
|
f2a35a7520 | ||
|
02c41eb97a | ||
|
06682ee36a | ||
|
97e3ee32e7 | ||
|
a4bc8fe544 | ||
|
e0d7e90f4a | ||
|
4404a6c74e | ||
|
ae8bf488d0 | ||
|
9f6e8a1833 | ||
|
af03c61f89 | ||
|
7a1e9adf33 | ||
|
eed42db645 | ||
|
7f8b5e9993 | ||
|
83552d6995 | ||
|
3bf393444d | ||
|
fd2ed08009 | ||
|
9b421548d6 | ||
|
f2d9a3ba6b | ||
|
abe90c0074 | ||
|
9a0cf5b9dc | ||
|
f9f82da58d | ||
|
a067d1b1b1 | ||
|
a97f0e6da9 | ||
|
58b18ada6f | ||
|
6f8c4692c8 | ||
|
ad4a04dae2 | ||
|
d62e59325b | ||
|
781f8a67df | ||
|
599bb377b7 | ||
|
97fd095666 | ||
|
3aec8e3acd | ||
|
1fdb7a45cf | ||
|
9f6c750236 | ||
|
4a52662ad8 | ||
|
0660ddba28 | ||
|
463eddb0f4 | ||
|
aa0c113e65 | ||
|
babd8b2093 | ||
|
23bcab5450 | ||
|
d766455d13 | ||
|
c9bea5d0ea | ||
|
8704ee42f1 | ||
|
bf366d8361 | ||
|
cf9729aac4 | ||
|
58475fe929 | ||
|
57c553f971 | ||
|
2b8aae4eee | ||
|
c5aa5d3deb | ||
|
3d8731f41d |
@@ -9,9 +9,8 @@
|
|||||||
"vscode": {
|
"vscode": {
|
||||||
"settings": {
|
"settings": {
|
||||||
"python.analysis.diagnosticMode": "workspace",
|
"python.analysis.diagnosticMode": "workspace",
|
||||||
"ruff.organizeImports": false,
|
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
"editor.defaultFormatter": "charliermarsh.ruff",
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.ruff": "explicit",
|
"source.fixAll.ruff": "explicit",
|
||||||
"source.organizeImports": "explicit"
|
"source.organizeImports": "explicit"
|
||||||
@@ -43,8 +42,6 @@
|
|||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"ms-python.vscode-pylance",
|
"ms-python.vscode-pylance",
|
||||||
"ms-python.isort",
|
|
||||||
"ms-python.black-formatter",
|
|
||||||
"charliermarsh.ruff",
|
"charliermarsh.ruff",
|
||||||
"EditorConfig.EditorConfig",
|
"EditorConfig.EditorConfig",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
|
2
.github/ISSUE_TEMPLATE/adapter_publish.yml
vendored
2
.github/ISSUE_TEMPLATE/adapter_publish.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: 发布适配器
|
name: 发布适配器
|
||||||
title: "Adapter: {name}"
|
title: "Adapter: {name}"
|
||||||
description: 发布适配器到 NoneBot 官方商店
|
description: 发布适配器到 NoneBot 官方商店
|
||||||
labels: ["Adapter"]
|
labels: ["Adapter", "Publish"]
|
||||||
body:
|
body:
|
||||||
- type: input
|
- type: input
|
||||||
id: name
|
id: name
|
||||||
|
2
.github/ISSUE_TEMPLATE/bot_publish.yml
vendored
2
.github/ISSUE_TEMPLATE/bot_publish.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: 发布机器人
|
name: 发布机器人
|
||||||
title: "Bot: {name}"
|
title: "Bot: {name}"
|
||||||
description: 发布机器人到 NoneBot 官方商店
|
description: 发布机器人到 NoneBot 官方商店
|
||||||
labels: ["Bot"]
|
labels: ["Bot", "Publish"]
|
||||||
body:
|
body:
|
||||||
- type: input
|
- type: input
|
||||||
id: name
|
id: name
|
||||||
|
2
.github/ISSUE_TEMPLATE/plugin_publish.yml
vendored
2
.github/ISSUE_TEMPLATE/plugin_publish.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: 发布插件
|
name: 发布插件
|
||||||
title: "Plugin: {name}"
|
title: "Plugin: {name}"
|
||||||
description: 发布插件到 NoneBot 官方商店
|
description: 发布插件到 NoneBot 官方商店
|
||||||
labels: ["Plugin"]
|
labels: ["Plugin", "Publish"]
|
||||||
body:
|
body:
|
||||||
- type: input
|
- type: input
|
||||||
id: pypi
|
id: pypi
|
||||||
|
12
.github/workflows/codecov.yml
vendored
12
.github/workflows/codecov.yml
vendored
@@ -48,11 +48,21 @@ jobs:
|
|||||||
cd ./envs/${{ matrix.env }}
|
cd ./envs/${{ matrix.env }}
|
||||||
poetry run bash "../../scripts/run-tests.sh"
|
poetry run bash "../../scripts/run-tests.sh"
|
||||||
|
|
||||||
|
- name: Upload test results
|
||||||
|
uses: codecov/test-results-action@v1
|
||||||
|
with:
|
||||||
|
env_vars: OS,PYTHON_VERSION,PYDANTIC_VERSION
|
||||||
|
files: ./tests/junit.xml
|
||||||
|
flags: unittests
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
- name: Upload coverage report
|
- name: Upload coverage report
|
||||||
uses: codecov/codecov-action@v4
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
env_vars: OS,PYTHON_VERSION,PYDANTIC_VERSION
|
env_vars: OS,PYTHON_VERSION,PYDANTIC_VERSION
|
||||||
files: ./tests/coverage.xml
|
files: ./tests/coverage.xml
|
||||||
flags: unittests
|
flags: unittests
|
||||||
|
fail_ci_if_error: true
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
88
.github/workflows/noneflow.yml
vendored
88
.github/workflows/noneflow.yml
vendored
@@ -15,9 +15,9 @@ concurrency:
|
|||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
noneflow:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: check
|
name: noneflow
|
||||||
# do not run on forked PRs, do not run on not related issues, do not run on pr comments
|
# do not run on forked PRs, do not run on not related issues, do not run on pr comments
|
||||||
if: |
|
if: |
|
||||||
!(
|
!(
|
||||||
@@ -36,70 +36,6 @@ jobs:
|
|||||||
github.event_name == 'issue_comment' && github.event.issue.pull_request
|
github.event_name == 'issue_comment' && github.event.issue.pull_request
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
steps:
|
|
||||||
- run: echo "Check passed"
|
|
||||||
reaction:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: reaction
|
|
||||||
needs: check
|
|
||||||
if: |
|
|
||||||
(
|
|
||||||
github.event_name == 'issue_comment' &&
|
|
||||||
github.event.action == 'created'
|
|
||||||
) ||
|
|
||||||
(
|
|
||||||
github.event_name == 'issues' &&
|
|
||||||
github.event.action == 'opened'
|
|
||||||
)
|
|
||||||
steps:
|
|
||||||
- name: Generate token
|
|
||||||
id: generate-token
|
|
||||||
uses: tibdex/github-app-token@v2
|
|
||||||
with:
|
|
||||||
app_id: ${{ secrets.APP_ID }}
|
|
||||||
private_key: ${{ secrets.APP_KEY }}
|
|
||||||
|
|
||||||
- name: Reaction on issue
|
|
||||||
if: github.event_name == 'issues'
|
|
||||||
run: |
|
|
||||||
gh api --method POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/reactions -f "content=rocket"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
||||||
|
|
||||||
- name: Reaction on issue comment
|
|
||||||
if: github.event_name == 'issue_comment'
|
|
||||||
run: |
|
|
||||||
gh api --method POST /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f "content=rocket"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
||||||
plugin_test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: nonebot2 plugin test
|
|
||||||
needs: check
|
|
||||||
permissions:
|
|
||||||
issues: read
|
|
||||||
outputs:
|
|
||||||
result: ${{ steps.plugin-test.outputs.RESULT }}
|
|
||||||
output: ${{ steps.plugin-test.outputs.OUTPUT }}
|
|
||||||
metadata: ${{ steps.plugin-test.outputs.METADATA }}
|
|
||||||
steps:
|
|
||||||
- name: Install Poetry
|
|
||||||
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
|
||||||
run: pipx install poetry
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.x"
|
|
||||||
|
|
||||||
- name: Test Plugin
|
|
||||||
id: plugin-test
|
|
||||||
run: |
|
|
||||||
curl -sSL https://github.com/nonebot/noneflow/releases/latest/download/plugin_test.py | python -
|
|
||||||
noneflow:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: noneflow
|
|
||||||
needs: plugin_test
|
|
||||||
steps:
|
steps:
|
||||||
- name: Generate token
|
- name: Generate token
|
||||||
id: generate-token
|
id: generate-token
|
||||||
@@ -113,29 +49,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ steps.generate-token.outputs.token }}
|
token: ${{ steps.generate-token.outputs.token }}
|
||||||
|
|
||||||
- name: Cache pre-commit hooks
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .cache/.pre-commit
|
|
||||||
key: noneflow-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
||||||
|
|
||||||
- name: NoneFlow
|
- name: NoneFlow
|
||||||
uses: docker://ghcr.io/nonebot/noneflow:latest
|
uses: docker://ghcr.io/nonebot/noneflow:latest
|
||||||
with:
|
with:
|
||||||
config: >
|
config: >
|
||||||
{
|
{
|
||||||
"base": "master",
|
"base": "master",
|
||||||
"plugin_path": "assets/plugins.json",
|
"plugin_path": "assets/plugins.json5",
|
||||||
"bot_path": "assets/bots.json",
|
"bot_path": "assets/bots.json5",
|
||||||
"adapter_path": "assets/adapters.json"
|
"adapter_path": "assets/adapters.json5",
|
||||||
|
"registry_repository": "nonebot/registry"
|
||||||
}
|
}
|
||||||
env:
|
env:
|
||||||
PLUGIN_TEST_RESULT: ${{ needs.plugin_test.outputs.result }}
|
|
||||||
PLUGIN_TEST_OUTPUT: ${{ needs.plugin_test.outputs.output }}
|
|
||||||
PLUGIN_TEST_METADATA: ${{ needs.plugin_test.outputs.metadata }}
|
|
||||||
APP_ID: ${{ secrets.APP_ID }}
|
APP_ID: ${{ secrets.APP_ID }}
|
||||||
PRIVATE_KEY: ${{ secrets.APP_KEY }}
|
PRIVATE_KEY: ${{ secrets.APP_KEY }}
|
||||||
PRE_COMMIT_HOME: /github/workspace/.cache/.pre-commit
|
|
||||||
|
|
||||||
- name: Fix permission
|
|
||||||
run: sudo chown -R $(whoami):$(id -ng) .cache/.pre-commit
|
|
||||||
|
9
.github/workflows/website-preview-cd.yml
vendored
9
.github/workflows/website-preview-cd.yml
vendored
@@ -45,11 +45,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Restore Context
|
- name: Restore Context
|
||||||
run: |
|
run: |
|
||||||
cat action.env >> $GITHUB_ENV
|
PR_NUMBER=$(cat ./pr-number)
|
||||||
|
if ! [[ "${PR_NUMBER}" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "Invalid PR number: ${PR_NUMBER}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Set Deploy Name
|
- name: Set Deploy Name
|
||||||
run: |
|
run: |
|
||||||
echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
|
echo "DEPLOY_NAME=deploy-preview-${PR_NUMBER}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
|
4
.github/workflows/website-preview-ci.yml
vendored
4
.github/workflows/website-preview-ci.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Export Context
|
- name: Export Context
|
||||||
run: |
|
run: |
|
||||||
echo "PR_NUMBER=${{ github.event.number }}" >> ./action.env
|
echo "${{ github.event.pull_request.number }}" > ./pr-number
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -38,5 +38,5 @@ jobs:
|
|||||||
name: website-preview
|
name: website-preview
|
||||||
path: |
|
path: |
|
||||||
./website/build
|
./website/build
|
||||||
./action.env
|
./pr-number
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
@@ -7,22 +7,12 @@ ci:
|
|||||||
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.7.1
|
rev: v0.8.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix]
|
||||||
stages: [pre-commit]
|
stages: [pre-commit]
|
||||||
|
- id: ruff-format
|
||||||
- repo: https://github.com/pycqa/isort
|
|
||||||
rev: 5.13.2
|
|
||||||
hooks:
|
|
||||||
- id: isort
|
|
||||||
stages: [pre-commit]
|
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
|
||||||
rev: 24.10.0
|
|
||||||
hooks:
|
|
||||||
- id: black
|
|
||||||
stages: [pre-commit]
|
stages: [pre-commit]
|
||||||
|
|
||||||
- repo: https://github.com/nonebot/nonemoji
|
- repo: https://github.com/nonebot/nonemoji
|
||||||
|
@@ -133,6 +133,7 @@ NoneBot2 是一个现代、跨平台、可扩展的 Python 聊天机器人框架
|
|||||||
| Villa([仓库](https://github.com/CMHopeSunshine/nonebot-adapter-villa)) | ❌ | 米游社大别野 Bot 协议,官方已下线 |
|
| Villa([仓库](https://github.com/CMHopeSunshine/nonebot-adapter-villa)) | ❌ | 米游社大别野 Bot 协议,官方已下线 |
|
||||||
| Rocket.Chat([仓库](https://github.com/IUnlimit/nonebot-adapter-rocketchat),[协议](https://developer.rocket.chat/)) | ↗️ | Rocket.Chat Bot 协议,由社区贡献 |
|
| Rocket.Chat([仓库](https://github.com/IUnlimit/nonebot-adapter-rocketchat),[协议](https://developer.rocket.chat/)) | ↗️ | Rocket.Chat Bot 协议,由社区贡献 |
|
||||||
| Tailchat([仓库](https://github.com/eya46/nonebot-adapter-tailchat),[协议](https://tailchat.msgbyte.com/)) | ↗️ | Tailchat 开放平台 Bot 协议,由社区贡献 |
|
| Tailchat([仓库](https://github.com/eya46/nonebot-adapter-tailchat),[协议](https://tailchat.msgbyte.com/)) | ↗️ | Tailchat 开放平台 Bot 协议,由社区贡献 |
|
||||||
|
| Mail([仓库](https://github.com/mobyw/nonebot-adapter-mail)) | ↗️ | 邮件收发协议,由社区贡献 |
|
||||||
|
|
||||||
- 坚实后盾:支持多种 web 框架,可自定义替换、组合
|
- 坚实后盾:支持多种 web 框架,可自定义替换、组合
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"project_link": "nonebot-adapter-onebot",
|
"project_link": "nonebot-adapter-onebot",
|
||||||
"name": "OneBot V11",
|
"name": "OneBot V11",
|
||||||
"desc": "OneBot V11 协议",
|
"desc": "OneBot V11 协议",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "https://onebot.adapters.nonebot.dev/",
|
"homepage": "https://onebot.adapters.nonebot.dev/",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"project_link": "nonebot-adapter-ding",
|
"project_link": "nonebot-adapter-ding",
|
||||||
"name": "钉钉",
|
"name": "钉钉",
|
||||||
"desc": "钉钉协议",
|
"desc": "钉钉协议",
|
||||||
"author": "Artin",
|
"author_id": 1184028,
|
||||||
"homepage": "https://github.com/nonebot/adapter-ding",
|
"homepage": "https://github.com/nonebot/adapter-ding",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"project_link": "nonebot-adapter-feishu",
|
"project_link": "nonebot-adapter-feishu",
|
||||||
"name": "飞书",
|
"name": "飞书",
|
||||||
"desc": "飞书协议",
|
"desc": "飞书协议",
|
||||||
"author": "StarHeartHunt",
|
"author_id": 14922941,
|
||||||
"homepage": "https://github.com/nonebot/adapter-feishu",
|
"homepage": "https://github.com/nonebot/adapter-feishu",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"project_link": "nonebot-adapter-telegram",
|
"project_link": "nonebot-adapter-telegram",
|
||||||
"name": "Telegram",
|
"name": "Telegram",
|
||||||
"desc": "Telegram 协议",
|
"desc": "Telegram 协议",
|
||||||
"author": "j1g5awi",
|
"author_id": 50312681,
|
||||||
"homepage": "https://github.com/nonebot/adapter-telegram",
|
"homepage": "https://github.com/nonebot/adapter-telegram",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"project_link": "nonebot-adapter-qq",
|
"project_link": "nonebot-adapter-qq",
|
||||||
"name": "QQ",
|
"name": "QQ",
|
||||||
"desc": "QQ 官方机器人",
|
"desc": "QQ 官方机器人",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "https://github.com/nonebot/adapter-qq",
|
"homepage": "https://github.com/nonebot/adapter-qq",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"project_link": "nonebot-adapter-kaiheila",
|
"project_link": "nonebot-adapter-kaiheila",
|
||||||
"name": "开黑啦",
|
"name": "开黑啦",
|
||||||
"desc": "开黑啦协议适配",
|
"desc": "开黑啦协议适配",
|
||||||
"author": "Tian-que",
|
"author_id": 37477320,
|
||||||
"homepage": "https://github.com/Tian-que/nonebot-adapter-kaiheila",
|
"homepage": "https://github.com/Tian-que/nonebot-adapter-kaiheila",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"project_link": "nonebot-adapter-mirai",
|
"project_link": "nonebot-adapter-mirai",
|
||||||
"name": "Mirai",
|
"name": "Mirai",
|
||||||
"desc": "mirai-api-http v2 协议适配",
|
"desc": "mirai-api-http v2 协议适配",
|
||||||
"author": "RF-Tar-Railt",
|
"author_id": 42648639,
|
||||||
"homepage": "https://github.com/nonebot/adapter-mirai",
|
"homepage": "https://github.com/nonebot/adapter-mirai",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
"project_link": "nonebot-adapter-onebot",
|
"project_link": "nonebot-adapter-onebot",
|
||||||
"name": "OneBot V12",
|
"name": "OneBot V12",
|
||||||
"desc": "OneBot V12 协议",
|
"desc": "OneBot V12 协议",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "https://onebot.adapters.nonebot.dev/",
|
"homepage": "https://onebot.adapters.nonebot.dev/",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"project_link": "nonebot-adapter-console",
|
"project_link": "nonebot-adapter-console",
|
||||||
"name": "Console",
|
"name": "Console",
|
||||||
"desc": "基于终端的交互式适配器",
|
"desc": "基于终端的交互式适配器",
|
||||||
"author": "Melodyknit",
|
"author_id": 50488999,
|
||||||
"homepage": "https://github.com/nonebot/adapter-console",
|
"homepage": "https://github.com/nonebot/adapter-console",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
"project_link": "nonebot-adapter-github",
|
"project_link": "nonebot-adapter-github",
|
||||||
"name": "GitHub",
|
"name": "GitHub",
|
||||||
"desc": "GitHub APP & OAuth APP integration",
|
"desc": "GitHub APP & OAuth APP integration",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "https://github.com/nonebot/adapter-github",
|
"homepage": "https://github.com/nonebot/adapter-github",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
"project_link": "nonebot-adapter-ntchat",
|
"project_link": "nonebot-adapter-ntchat",
|
||||||
"name": "Ntchat",
|
"name": "Ntchat",
|
||||||
"desc": "pc hook的微信客户端适配",
|
"desc": "pc hook的微信客户端适配",
|
||||||
"author": "JustUndertaker",
|
"author_id": 37363867,
|
||||||
"homepage": "https://github.com/JustUndertaker/adapter-ntchat",
|
"homepage": "https://github.com/JustUndertaker/adapter-ntchat",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
"project_link": "nonebot-adapter-minecraft",
|
"project_link": "nonebot-adapter-minecraft",
|
||||||
"name": "Minecraft",
|
"name": "Minecraft",
|
||||||
"desc": "MineCraft通信适配,支持Rcon",
|
"desc": "MineCraft通信适配,支持Rcon",
|
||||||
"author": "17TheWord",
|
"author_id": 54731914,
|
||||||
"homepage": "https://github.com/17TheWord/nonebot-adapter-minecraft",
|
"homepage": "https://github.com/17TheWord/nonebot-adapter-minecraft",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
"project_link": "nonebot-adapter-bilibili",
|
"project_link": "nonebot-adapter-bilibili",
|
||||||
"name": "BilibiliLive",
|
"name": "BilibiliLive",
|
||||||
"desc": "b站直播间ws协议",
|
"desc": "b站直播间ws协议",
|
||||||
"author": "wwweww",
|
"author_id": 39620657,
|
||||||
"homepage": "https://github.com/wwweww/adapter-bilibili",
|
"homepage": "https://github.com/wwweww/adapter-bilibili",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
"project_link": "nonebot-adapter-walleq",
|
"project_link": "nonebot-adapter-walleq",
|
||||||
"name": "Walle-Q",
|
"name": "Walle-Q",
|
||||||
"desc": "内置 QQ 协议实现",
|
"desc": "内置 QQ 协议实现",
|
||||||
"author": "abrahum",
|
"author_id": 18395948,
|
||||||
"homepage": "https://github.com/onebot-walle/nonebot_adapter_walleq",
|
"homepage": "https://github.com/onebot-walle/nonebot_adapter_walleq",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
"project_link": "nonebot-adapter-villa",
|
"project_link": "nonebot-adapter-villa",
|
||||||
"name": "大别野",
|
"name": "大别野",
|
||||||
"desc": "米游社大别野官方Bot适配",
|
"desc": "米游社大别野官方Bot适配",
|
||||||
"author": "CMHopeSunshine",
|
"author_id": 63870437,
|
||||||
"homepage": "https://github.com/CMHopeSunshine/nonebot-adapter-villa",
|
"homepage": "https://github.com/CMHopeSunshine/nonebot-adapter-villa",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
"project_link": "nonebot-adapter-red",
|
"project_link": "nonebot-adapter-red",
|
||||||
"name": "RedProtocol",
|
"name": "RedProtocol",
|
||||||
"desc": "QQNT RedProtocol 适配",
|
"desc": "QQNT RedProtocol 适配",
|
||||||
"author": "zhaomaoniu",
|
"author_id": 55650833,
|
||||||
"homepage": "https://github.com/nonebot/adapter-red",
|
"homepage": "https://github.com/nonebot/adapter-red",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
"project_link": "nonebot-adapter-discord",
|
"project_link": "nonebot-adapter-discord",
|
||||||
"name": "Discord",
|
"name": "Discord",
|
||||||
"desc": "Discord 官方 Bot 协议适配",
|
"desc": "Discord 官方 Bot 协议适配",
|
||||||
"author": "CMHopeSunshine",
|
"author_id": 63870437,
|
||||||
"homepage": "https://github.com/nonebot/adapter-discord",
|
"homepage": "https://github.com/nonebot/adapter-discord",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
"project_link": "nonebot-adapter-satori",
|
"project_link": "nonebot-adapter-satori",
|
||||||
"name": "Satori",
|
"name": "Satori",
|
||||||
"desc": "Satori 协议适配器",
|
"desc": "Satori 协议适配器",
|
||||||
"author": "RF-Tar-Railt",
|
"author_id": 42648639,
|
||||||
"homepage": "https://github.com/nonebot/adapter-satori",
|
"homepage": "https://github.com/nonebot/adapter-satori",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@
|
|||||||
"project_link": "nonebot-adapter-dodo",
|
"project_link": "nonebot-adapter-dodo",
|
||||||
"name": "DoDo",
|
"name": "DoDo",
|
||||||
"desc": "DoDo Bot 协议适配器",
|
"desc": "DoDo Bot 协议适配器",
|
||||||
"author": "CMHopeSunshine",
|
"author_id": 63870437,
|
||||||
"homepage": "https://github.com/nonebot/adapter-dodo",
|
"homepage": "https://github.com/nonebot/adapter-dodo",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -219,7 +219,7 @@
|
|||||||
"project_link": "nonebot-adapter-rocketchat",
|
"project_link": "nonebot-adapter-rocketchat",
|
||||||
"name": "RocketChat",
|
"name": "RocketChat",
|
||||||
"desc": "RocketChat adapter for nonebot2",
|
"desc": "RocketChat adapter for nonebot2",
|
||||||
"author": "IllTamer",
|
"author_id": 78360471,
|
||||||
"homepage": "https://github.com/IUnlimit/nonebot-adapter-rocketchat",
|
"homepage": "https://github.com/IUnlimit/nonebot-adapter-rocketchat",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
"project_link": "nonebot-adapter-kritor",
|
"project_link": "nonebot-adapter-kritor",
|
||||||
"name": "Kritor",
|
"name": "Kritor",
|
||||||
"desc": "Kritor 协议适配",
|
"desc": "Kritor 协议适配",
|
||||||
"author": "RF-Tar-Railt",
|
"author_id": 42648639,
|
||||||
"homepage": "https://github.com/nonebot/adapter-kritor",
|
"homepage": "https://github.com/nonebot/adapter-kritor",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -244,9 +244,19 @@
|
|||||||
"project_link": "nonebot-adapter-tailchat",
|
"project_link": "nonebot-adapter-tailchat",
|
||||||
"name": "Tailchat",
|
"name": "Tailchat",
|
||||||
"desc": "Tailchat 适配器",
|
"desc": "Tailchat 适配器",
|
||||||
"author": "eya46",
|
"author_id": 61458340,
|
||||||
"homepage": "https://github.com/eya46/nonebot-adapter-tailchat",
|
"homepage": "https://github.com/eya46/nonebot-adapter-tailchat",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot.adapters.mail",
|
||||||
|
"project_link": "nonebot-adapter-mail",
|
||||||
|
"name": "Mail",
|
||||||
|
"desc": "邮件收发协议",
|
||||||
|
"author_id": 44370805,
|
||||||
|
"homepage": "https://github.com/mobyw/nonebot-adapter-mail",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
]
|
]
|
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"name": "HarukaBot",
|
"name": "HarukaBot",
|
||||||
"desc": "将B站UP主的动态和直播信息推送至QQ",
|
"desc": "将B站UP主的动态和直播信息推送至QQ",
|
||||||
"author": "SK-415",
|
"author_id": 36433929,
|
||||||
"homepage": "https://github.com/SK-415/HarukaBot",
|
"homepage": "https://github.com/SK-415/HarukaBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Omega Miya",
|
"name": "Omega Miya",
|
||||||
"desc": "B站推送Pixiv搜图识番求签抽卡表情包还有其他杂七杂八的功能",
|
"desc": "B站推送Pixiv搜图识番求签抽卡表情包还有其他杂七杂八的功能",
|
||||||
"author": "Ailitonia",
|
"author_id": 41713304,
|
||||||
"homepage": "https://github.com/Ailitonia/omega-miya",
|
"homepage": "https://github.com/Ailitonia/omega-miya",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Github Bot",
|
"name": "Github Bot",
|
||||||
"desc": "在QQ获取/处理Github repo/pr/issue",
|
"desc": "在QQ获取/处理Github repo/pr/issue",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "https://github.com/cscs181/QQ-GitHub-Bot",
|
"homepage": "https://github.com/cscs181/QQ-GitHub-Bot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
{
|
{
|
||||||
"name": "YanXiBot",
|
"name": "YanXiBot",
|
||||||
"desc": "动漫资源查找与娱乐机器人",
|
"desc": "动漫资源查找与娱乐机器人",
|
||||||
"author": "Melodyknit",
|
"author_id": 50488999,
|
||||||
"homepage": "https://github.com/Melodyknit/YanXiBot",
|
"homepage": "https://github.com/Melodyknit/YanXiBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
{
|
{
|
||||||
"name": "绪山真寻bot",
|
"name": "绪山真寻bot",
|
||||||
"desc": "含有不少的娱乐功能同时稍稍有一些实用的功能 :P",
|
"desc": "含有不少的娱乐功能同时稍稍有一些实用的功能 :P",
|
||||||
"author": "HibiKier",
|
"author_id": 45528451,
|
||||||
"homepage": "https://github.com/HibiKier/zhenxun_bot",
|
"homepage": "https://github.com/HibiKier/zhenxun_bot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ATRI",
|
"name": "ATRI",
|
||||||
"desc": "高性能文爱萝卜子,糅杂了各类有趣小功能",
|
"desc": "高性能文爱萝卜子,糅杂了各类有趣小功能",
|
||||||
"author": "Kyomotoi",
|
"author_id": 37587870,
|
||||||
"homepage": "https://github.com/Kyomotoi/ATRI",
|
"homepage": "https://github.com/Kyomotoi/ATRI",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
{
|
{
|
||||||
"name": "dumbot傻瓜机器人",
|
"name": "dumbot傻瓜机器人",
|
||||||
"desc": "猜一猜游戏、新闻一览、英文每日一词一短语等等,含一键启动及docker容器部署就绪",
|
"desc": "猜一猜游戏、新闻一览、英文每日一词一短语等等,含一键启动及docker容器部署就绪",
|
||||||
"author": "ffreemt",
|
"author_id": 52522252,
|
||||||
"homepage": "https://github.com/ffreemt/koyeb-nb2",
|
"homepage": "https://github.com/ffreemt/koyeb-nb2",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
{
|
{
|
||||||
"name": "DicePP",
|
"name": "DicePP",
|
||||||
"desc": "TRPG骰娘, 带先攻, 查询等功能, 主要面向DND5E. 面对骰主推出的船新版本, 内置Windows/Linux详细部署指南以及方便的自定义骰娘方法, 从回复文本到查询资料库都可轻松配置~",
|
"desc": "TRPG骰娘, 带先攻, 查询等功能, 主要面向DND5E. 面对骰主推出的船新版本, 内置Windows/Linux详细部署指南以及方便的自定义骰娘方法, 从回复文本到查询资料库都可轻松配置~",
|
||||||
"author": "pear-studio",
|
"author_id": 88259371,
|
||||||
"homepage": "https://github.com/pear-studio/nonebot-dicepp",
|
"homepage": "https://github.com/pear-studio/nonebot-dicepp",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SetuBot",
|
"name": "SetuBot",
|
||||||
"desc": "每个群配置文件独立,可以控制频率,socks http代理,R18开关,支持多tag,自建API lolicon Pixiv热度榜",
|
"desc": "每个群配置文件独立,可以控制频率,socks http代理,R18开关,支持多tag,自建API lolicon Pixiv热度榜",
|
||||||
"author": "yuban10703",
|
"author_id": 39484884,
|
||||||
"homepage": "https://github.com/yuban10703/setu-nonebot2",
|
"homepage": "https://github.com/yuban10703/setu-nonebot2",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
{
|
{
|
||||||
"name": "剑网三bot",
|
"name": "剑网三bot",
|
||||||
"desc": "网络游戏《剑侠情缘三》的群聊机器人,数据使用:www.jx3api.com",
|
"desc": "网络游戏《剑侠情缘三》的群聊机器人,数据使用:www.jx3api.com",
|
||||||
"author": "JustUndertaker",
|
"author_id": 37363867,
|
||||||
"homepage": "https://github.com/JustUndertaker/mini_jx3_bot",
|
"homepage": "https://github.com/JustUndertaker/mini_jx3_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
{
|
{
|
||||||
"name": "PixivBot",
|
"name": "PixivBot",
|
||||||
"desc": "顾名思义是Pixiv的bot(随机推荐插画、随机指定关键词插画、随机书签、查看排行榜、查看指定id插画)",
|
"desc": "顾名思义是Pixiv的bot(随机推荐插画、随机指定关键词插画、随机书签、查看排行榜、查看指定id插画)",
|
||||||
"author": "ssttkkl",
|
"author_id": 17331698,
|
||||||
"homepage": "https://github.com/ssttkkl/PixivBot",
|
"homepage": "https://github.com/ssttkkl/PixivBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SeaBot_QQ",
|
"name": "SeaBot_QQ",
|
||||||
"desc": "一个能够获取新闻资讯并推送至QQ的群聊机器人。",
|
"desc": "一个能够获取新闻资讯并推送至QQ的群聊机器人。",
|
||||||
"author": "B1ue1nWh1te",
|
"author_id": 31682561,
|
||||||
"homepage": "https://github.com/B1ue1nWh1te/SeaBot_QQ",
|
"homepage": "https://github.com/B1ue1nWh1te/SeaBot_QQ",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
{
|
{
|
||||||
"name": "琪露诺Bot",
|
"name": "琪露诺Bot",
|
||||||
"desc": "用QQ机器人控制Minecraft服务器!服务器状态查询/服务器白名单/插件列表/玩家查询/转发服务器消息/执行指令... 其他实用娱乐功能,三步即可成功部署的QQ bot",
|
"desc": "用QQ机器人控制Minecraft服务器!服务器状态查询/服务器白名单/插件列表/玩家查询/转发服务器消息/执行指令... 其他实用娱乐功能,三步即可成功部署的QQ bot",
|
||||||
"author": "summerkirakira",
|
"author_id": 56951617,
|
||||||
"homepage": "https://github.com/summerkirakira/CirnoBot",
|
"homepage": "https://github.com/summerkirakira/CirnoBot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Inkar Suki",
|
"name": "Inkar Suki",
|
||||||
"desc": "一个十分方便的Bot,支持包括Webhook、群管、剑网3等一系列功能,持续更新中……",
|
"desc": "一个十分方便的Bot,支持包括Webhook、群管、剑网3等一系列功能,持续更新中……",
|
||||||
"author": "HornCopper",
|
"author_id": 68726147,
|
||||||
"homepage": "https://github.com/HornCopper/Inkar-Suki",
|
"homepage": "https://github.com/HornCopper/Inkar-Suki",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
{
|
{
|
||||||
"name": "屑岛风Bot",
|
"name": "屑岛风Bot",
|
||||||
"desc": "自家用屑Bot",
|
"desc": "自家用屑Bot",
|
||||||
"author": "kexue-z",
|
"author_id": 71873002,
|
||||||
"homepage": "https://github.com/kexue-z/Dao-bot",
|
"homepage": "https://github.com/kexue-z/Dao-bot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
{
|
{
|
||||||
"name": "LiteyukiBot-轻雪机器人",
|
"name": "LiteyukiBot-轻雪机器人",
|
||||||
"desc": "一个有各种琐事功能的bot,有AI接口,能陪聊",
|
"desc": "一个有各种琐事功能的bot,有AI接口,能陪聊",
|
||||||
"author": "snowyfirefly",
|
"author_id": 79104275,
|
||||||
"homepage": "https://github.com/snowyfirefly/Liteyuki",
|
"homepage": "https://github.com/snowyfirefly/Liteyuki",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nya_bot",
|
"name": "nya_bot",
|
||||||
"desc": "喵服——战魂铭人联机服务器兼机器人",
|
"desc": "喵服——战魂铭人联机服务器兼机器人",
|
||||||
"author": "nikissXI",
|
"author_id": 31379266,
|
||||||
"homepage": "https://github.com/nikissXI/nya_bot",
|
"homepage": "https://github.com/nikissXI/nya_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
{
|
{
|
||||||
"name": "真宵Bot",
|
"name": "真宵Bot",
|
||||||
"desc": "专注群聊的QQ机器人",
|
"desc": "专注群聊的QQ机器人",
|
||||||
"author": "Shine-Light",
|
"author_id": 71173418,
|
||||||
"homepage": "https://github.com/Shine-Light/Nonebot_Bot_MayaFey",
|
"homepage": "https://github.com/Shine-Light/Nonebot_Bot_MayaFey",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SkadiBot",
|
"name": "SkadiBot",
|
||||||
"desc": "明日方舟主题机器人—斯卡蒂",
|
"desc": "明日方舟主题机器人—斯卡蒂",
|
||||||
"author": "yuyuziYYZ",
|
"author_id": 101615359,
|
||||||
"homepage": "https://github.com/yuyuziYYZ/skadi_bot",
|
"homepage": "https://github.com/yuyuziYYZ/skadi_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -217,7 +217,7 @@
|
|||||||
{
|
{
|
||||||
"name": "小白机器人",
|
"name": "小白机器人",
|
||||||
"desc": "一个高度依赖数据库的群管理机器人",
|
"desc": "一个高度依赖数据库的群管理机器人",
|
||||||
"author": "SDIJF1521",
|
"author_id": 69745333,
|
||||||
"homepage": "https://github.com/SDIJF1521/qqai",
|
"homepage": "https://github.com/SDIJF1521/qqai",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
{
|
{
|
||||||
"name": "LittlePaimon",
|
"name": "LittlePaimon",
|
||||||
"desc": "小派蒙,多功能原神机器人。",
|
"desc": "小派蒙,多功能原神机器人。",
|
||||||
"author": "CMHopeSunshine",
|
"author_id": 63870437,
|
||||||
"homepage": "https://github.com/CMHopeSunshine/LittlePaimon",
|
"homepage": "https://github.com/CMHopeSunshine/LittlePaimon",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
{
|
{
|
||||||
"name": "IdhagnBot",
|
"name": "IdhagnBot",
|
||||||
"desc": "🐱🤖 一个以娱乐功能为主的缝合怪(划掉)QQ机器人,包含一定Furry要素但是不会卖萌(就是逊啦!)",
|
"desc": "🐱🤖 一个以娱乐功能为主的缝合怪(划掉)QQ机器人,包含一定Furry要素但是不会卖萌(就是逊啦!)",
|
||||||
"author": "su226",
|
"author_id": 17371317,
|
||||||
"homepage": "https://github.com/su226/IdhagnBot",
|
"homepage": "https://github.com/su226/IdhagnBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
{
|
{
|
||||||
"name": "hsbot",
|
"name": "hsbot",
|
||||||
"desc": "服务于《炉石传说》玩家的机器人,上线至今已有加入十余个个炉石相关群聊,上千名用户使用,响应请求数万次。 数据使用:HSreplay, Fbigame, Hearthstone API",
|
"desc": "服务于《炉石传说》玩家的机器人,上线至今已有加入十余个个炉石相关群聊,上千名用户使用,响应请求数万次。 数据使用:HSreplay, Fbigame, Hearthstone API",
|
||||||
"author": "gzy02",
|
"author_id": 67055520,
|
||||||
"homepage": "https://github.com/gzy02/hsbot",
|
"homepage": "https://github.com/gzy02/hsbot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Bread Dog Bot",
|
"name": "Bread Dog Bot",
|
||||||
"desc": "Terraria TShock QQ 机器人",
|
"desc": "Terraria TShock QQ 机器人",
|
||||||
"author": "Qianyiovo",
|
"author_id": 160252668,
|
||||||
"homepage": "https://github.com/Qianyiovo/bread_dog_bot",
|
"homepage": "https://github.com/Qianyiovo/bread_dog_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
{
|
{
|
||||||
"name": "RanBot",
|
"name": "RanBot",
|
||||||
"desc": "不@会很安静的Bot",
|
"desc": "不@会很安静的Bot",
|
||||||
"author": "IAXRetailer",
|
"author_id": 88923783,
|
||||||
"homepage": "https://github.com/Hecatia-Hell-Workshop/RanBot",
|
"homepage": "https://github.com/Hecatia-Hell-Workshop/RanBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
{
|
{
|
||||||
"name": "辞辞(cici)Bot",
|
"name": "辞辞(cici)Bot",
|
||||||
"desc": "一个集成娱乐和群管为一体的机器人",
|
"desc": "一个集成娱乐和群管为一体的机器人",
|
||||||
"author": "mengxinyuan638",
|
"author_id": 90902259,
|
||||||
"homepage": "https://github.com/mengxinyuan638/cici-bot",
|
"homepage": "https://github.com/mengxinyuan638/cici-bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -318,7 +318,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SuzunoBot",
|
"name": "SuzunoBot",
|
||||||
"desc": "多功能音游bot,主要服务maimaiDX、Arcaea",
|
"desc": "多功能音游bot,主要服务maimaiDX、Arcaea",
|
||||||
"author": "Rinfair-CSP-A016",
|
"author_id": 29980586,
|
||||||
"homepage": "https://github.com/Rinfair-CSP-A016/SuzunoBot-AGLAS",
|
"homepage": "https://github.com/Rinfair-CSP-A016/SuzunoBot-AGLAS",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -339,7 +339,7 @@
|
|||||||
{
|
{
|
||||||
"name": "青岚",
|
"name": "青岚",
|
||||||
"desc": "基于NoneBot的与Minecraft Server互通消息的机器人",
|
"desc": "基于NoneBot的与Minecraft Server互通消息的机器人",
|
||||||
"author": "17TheWord",
|
"author_id": 54731914,
|
||||||
"homepage": "https://github.com/17TheWord/qinglan_bot",
|
"homepage": "https://github.com/17TheWord/qinglan_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -352,7 +352,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ChensQBOTv2",
|
"name": "ChensQBOTv2",
|
||||||
"desc": "多功能QQ群机器人,权限管理/联ban/社工等等等等,以及拥有一个强大的开发者",
|
"desc": "多功能QQ群机器人,权限管理/联ban/社工等等等等,以及拥有一个强大的开发者",
|
||||||
"author": "cnchens",
|
"author_id": 116929900,
|
||||||
"homepage": "https://github.com/cnchens/ChensQBOTv2",
|
"homepage": "https://github.com/cnchens/ChensQBOTv2",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -360,7 +360,7 @@
|
|||||||
{
|
{
|
||||||
"name": "koishi",
|
"name": "koishi",
|
||||||
"desc": "支持爬取 codeforces, atcoder, 牛客上程序设计赛事的 bot。",
|
"desc": "支持爬取 codeforces, atcoder, 牛客上程序设计赛事的 bot。",
|
||||||
"author": "CupidsBow",
|
"author_id": 71639222,
|
||||||
"homepage": "https://github.com/CupidsBow/koishi",
|
"homepage": "https://github.com/CupidsBow/koishi",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -381,7 +381,7 @@
|
|||||||
{
|
{
|
||||||
"name": "脑积水",
|
"name": "脑积水",
|
||||||
"desc": "一个超级缝合怪...",
|
"desc": "一个超级缝合怪...",
|
||||||
"author": "zhulinyv",
|
"author_id": 66541860,
|
||||||
"homepage": "https://github.com/zhulinyv/NJS",
|
"homepage": "https://github.com/zhulinyv/NJS",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -394,7 +394,7 @@
|
|||||||
{
|
{
|
||||||
"name": "LOVE酱",
|
"name": "LOVE酱",
|
||||||
"desc": "为铁锈战争游戏群服务的虚拟少女,内置了爬取铁锈房间列表功能,以及游戏内单位查询功能,并制作了教学系统以及铁锈相关游戏群的收集功能。",
|
"desc": "为铁锈战争游戏群服务的虚拟少女,内置了爬取铁锈房间列表功能,以及游戏内单位查询功能,并制作了教学系统以及铁锈相关游戏群的收集功能。",
|
||||||
"author": "allureluoli",
|
"author_id": 106828088,
|
||||||
"homepage": "https://github.com/allureluoli/LOVE-",
|
"homepage": "https://github.com/allureluoli/LOVE-",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -411,7 +411,7 @@
|
|||||||
{
|
{
|
||||||
"name": "fubot",
|
"name": "fubot",
|
||||||
"desc": "基于nonebot与go-cqhttp的QQ娱乐bot,提供群日常娱乐功能与舞萌DX游戏相关的信息查询功能。",
|
"desc": "基于nonebot与go-cqhttp的QQ娱乐bot,提供群日常娱乐功能与舞萌DX游戏相关的信息查询功能。",
|
||||||
"author": "HCskia",
|
"author_id": 54059896,
|
||||||
"homepage": "https://github.com/HCskia/fu-Bot",
|
"homepage": "https://github.com/HCskia/fu-Bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
{
|
{
|
||||||
"name": "桃桃酱",
|
"name": "桃桃酱",
|
||||||
"desc": "一个会拆家的高性能缝合萝卜子",
|
"desc": "一个会拆家的高性能缝合萝卜子",
|
||||||
"author": "tkgs0",
|
"author_id": 107618388,
|
||||||
"homepage": "https://github.com/tkgs0/Momoko",
|
"homepage": "https://github.com/tkgs0/Momoko",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -432,7 +432,7 @@
|
|||||||
{
|
{
|
||||||
"name": "CoolQBot",
|
"name": "CoolQBot",
|
||||||
"desc": "基于 NoneBot2 的聊天机器人",
|
"desc": "基于 NoneBot2 的聊天机器人",
|
||||||
"author": "he0119",
|
"author_id": 5219550,
|
||||||
"homepage": "https://github.com/he0119/CoolQBot",
|
"homepage": "https://github.com/he0119/CoolQBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -440,7 +440,7 @@
|
|||||||
{
|
{
|
||||||
"name": "XDbot2",
|
"name": "XDbot2",
|
||||||
"desc": "简单的QQ功能型机器人",
|
"desc": "简单的QQ功能型机器人",
|
||||||
"author": "This-is-XiaoDeng",
|
"author_id": 104149371,
|
||||||
"homepage": "https://github.com/ITCraftDevelopmentTeam/XDbot2",
|
"homepage": "https://github.com/ITCraftDevelopmentTeam/XDbot2",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -448,7 +448,7 @@
|
|||||||
{
|
{
|
||||||
"name": "March7th",
|
"name": "March7th",
|
||||||
"desc": "三月七 - 崩坏:星穹铁道机器人",
|
"desc": "三月七 - 崩坏:星穹铁道机器人",
|
||||||
"author": "mobyw",
|
"author_id": 44370805,
|
||||||
"homepage": "https://github.com/Mar-7th/March7th",
|
"homepage": "https://github.com/Mar-7th/March7th",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -465,7 +465,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ay机器人",
|
"name": "ay机器人",
|
||||||
"desc": "codeforces和洛谷卷王监视、股票监控、ai聊天",
|
"desc": "codeforces和洛谷卷王监视、股票监控、ai聊天",
|
||||||
"author": "863109569",
|
"author_id": 77315378,
|
||||||
"homepage": "https://github.com/863109569/qqbot",
|
"homepage": "https://github.com/863109569/qqbot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -486,7 +486,7 @@
|
|||||||
{
|
{
|
||||||
"name": "狐尾",
|
"name": "狐尾",
|
||||||
"desc": "一个整合了兽云祭api的机器人,支持账号令牌操作,以及上传兽图",
|
"desc": "一个整合了兽云祭api的机器人,支持账号令牌操作,以及上传兽图",
|
||||||
"author": "bingqiu456",
|
"author_id": 99388013,
|
||||||
"homepage": "https://github.com/bingqiu456/shouyun",
|
"homepage": "https://github.com/bingqiu456/shouyun",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -499,7 +499,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ReimeiBot-黎明机器人",
|
"name": "ReimeiBot-黎明机器人",
|
||||||
"desc": "流星飞逝,黎明终将到来。",
|
"desc": "流星飞逝,黎明终将到来。",
|
||||||
"author": "ThirdBlood",
|
"author_id": 65395090,
|
||||||
"homepage": "https://github.com/3rdBit/ReimeiBot",
|
"homepage": "https://github.com/3rdBit/ReimeiBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -507,7 +507,7 @@
|
|||||||
{
|
{
|
||||||
"name": "web_bot",
|
"name": "web_bot",
|
||||||
"desc": "把机器人搬到网络上",
|
"desc": "把机器人搬到网络上",
|
||||||
"author": "wsdtl",
|
"author_id": 63489103,
|
||||||
"homepage": "https://github.com/wsdtl/web_bot",
|
"homepage": "https://github.com/wsdtl/web_bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -520,7 +520,7 @@
|
|||||||
{
|
{
|
||||||
"name": "林汐",
|
"name": "林汐",
|
||||||
"desc": "多平台功能型Bot",
|
"desc": "多平台功能型Bot",
|
||||||
"author": "mute23-code",
|
"author_id": 110453675,
|
||||||
"homepage": "https://github.com/netsora/SoraBot",
|
"homepage": "https://github.com/netsora/SoraBot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -537,7 +537,7 @@
|
|||||||
{
|
{
|
||||||
"name": "米缸",
|
"name": "米缸",
|
||||||
"desc": "基于nonebot2的米缸Bot",
|
"desc": "基于nonebot2的米缸Bot",
|
||||||
"author": "LambdaYH",
|
"author_id": 13503375,
|
||||||
"homepage": "https://github.com/LambdaYH/MigangBot",
|
"homepage": "https://github.com/LambdaYH/MigangBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -545,7 +545,7 @@
|
|||||||
{
|
{
|
||||||
"name": "不正经的妹妹",
|
"name": "不正经的妹妹",
|
||||||
"desc": "一款功能丰富、简单易用、自定义性强、扩展性强的可爱的QQ娱乐机器人",
|
"desc": "一款功能丰富、简单易用、自定义性强、扩展性强的可爱的QQ娱乐机器人",
|
||||||
"author": "itsevin",
|
"author_id": 104713034,
|
||||||
"homepage": "https://github.com/itsevin/sister_bot",
|
"homepage": "https://github.com/itsevin/sister_bot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -553,7 +553,7 @@
|
|||||||
{
|
{
|
||||||
"name": "星见Kirami",
|
"name": "星见Kirami",
|
||||||
"desc": "🌟 读作 Kirami,写作星见,简明轻快的聊天机器人应用。",
|
"desc": "🌟 读作 Kirami,写作星见,简明轻快的聊天机器人应用。",
|
||||||
"author": "A-kirami",
|
"author_id": 66513481,
|
||||||
"homepage": "https://kiramibot.dev/",
|
"homepage": "https://kiramibot.dev/",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -561,7 +561,7 @@
|
|||||||
{
|
{
|
||||||
"name": "OCNbot",
|
"name": "OCNbot",
|
||||||
"desc": "OI Contest Notifier bot,一个可以推送洛谷、cf、atcoder、牛客比赛通知的bot",
|
"desc": "OI Contest Notifier bot,一个可以推送洛谷、cf、atcoder、牛客比赛通知的bot",
|
||||||
"author": "ACnoway",
|
"author_id": 91535478,
|
||||||
"homepage": "https://github.com/ACnoway/OCNbot",
|
"homepage": "https://github.com/ACnoway/OCNbot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -578,7 +578,7 @@
|
|||||||
{
|
{
|
||||||
"name": "妃爱",
|
"name": "妃爱",
|
||||||
"desc": "超可爱的妃爱QQ群聊机器人",
|
"desc": "超可爱的妃爱QQ群聊机器人",
|
||||||
"author": "jiangyuxiaoxiao",
|
"author_id": 52267304,
|
||||||
"homepage": "https://github.com/jiangyuxiaoxiao/Hiyori",
|
"homepage": "https://github.com/jiangyuxiaoxiao/Hiyori",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -586,7 +586,7 @@
|
|||||||
{
|
{
|
||||||
"name": "芙芙",
|
"name": "芙芙",
|
||||||
"desc": "供 Mooncell Wiki 协作使用的跨平台机器人",
|
"desc": "供 Mooncell Wiki 协作使用的跨平台机器人",
|
||||||
"author": "StarHeartHunt",
|
"author_id": 14922941,
|
||||||
"homepage": "https://github.com/MooncellWiki/BotFooChan",
|
"homepage": "https://github.com/MooncellWiki/BotFooChan",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -594,7 +594,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Sakiko",
|
"name": "Sakiko",
|
||||||
"desc": "基于 LiteLoaderBDS 的 Minecraft 基岩版 Bot",
|
"desc": "基于 LiteLoaderBDS 的 Minecraft 基岩版 Bot",
|
||||||
"author": "zhaomaoniu",
|
"author_id": 55650833,
|
||||||
"homepage": "https://github.com/zhaomaoniu/Sakiko",
|
"homepage": "https://github.com/zhaomaoniu/Sakiko",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -608,18 +608,10 @@
|
|||||||
],
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "星辰 Bot",
|
|
||||||
"desc": "欢迎使用 星辰 Bot 项目!这是一款基于 NoneBot2 打造的智能 QQ 机器人,旨在为用户提供丰富的功能体验。无论是获取一言的灵感,探索历史上的今天,还是穿梭60s世界,星辰 Bot 为您打开了全新的交流之门。快来尝试吧!",
|
|
||||||
"author": "StarXinXin",
|
|
||||||
"homepage": "https://github.com/StarXinXin/StarsBot",
|
|
||||||
"tags": [],
|
|
||||||
"is_official": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Minecraft_QQBot",
|
"name": "Minecraft_QQBot",
|
||||||
"desc": "基于 NoneBot2 的 Minecraft 群服互联 QQ 机器人,支持多服务器多种方式连接。",
|
"desc": "基于 NoneBot2 的 Minecraft 群服互联 QQ 机器人,支持多服务器多种方式连接。",
|
||||||
"author": "Lonely-Sails",
|
"author_id": 90964775,
|
||||||
"homepage": "https://github.com/Minecraft-QQBot/BotServer",
|
"homepage": "https://github.com/Minecraft-QQBot/BotServer",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -636,7 +628,7 @@
|
|||||||
{
|
{
|
||||||
"name": "小安提Bot",
|
"name": "小安提Bot",
|
||||||
"desc": "服务于音游 舞萌DX 的多功能Bot",
|
"desc": "服务于音游 舞萌DX 的多功能Bot",
|
||||||
"author": "Ant1816",
|
"author_id": 186144551,
|
||||||
"homepage": "https://github.com/Ant1816/Ant1Bot",
|
"homepage": "https://github.com/Ant1816/Ant1Bot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
@@ -653,9 +645,22 @@
|
|||||||
{
|
{
|
||||||
"name": "CanrotBot",
|
"name": "CanrotBot",
|
||||||
"desc": "有很多实用功能的bot,也有很多没什么用的娱乐功能;接入了大模型,并且有一部分功能可以被大模型调用。主打一个全都有(",
|
"desc": "有很多实用功能的bot,也有很多没什么用的娱乐功能;接入了大模型,并且有一部分功能可以被大模型调用。主打一个全都有(",
|
||||||
"author": "wangyw15",
|
"author_id": 18070676,
|
||||||
"homepage": "https://github.com/wangyw15/CanrotBot",
|
"homepage": "https://github.com/wangyw15/CanrotBot",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "Mio澪",
|
||||||
|
"desc": "超可爱多功能Qbot",
|
||||||
|
"author_id": 50508678,
|
||||||
|
"homepage": "https://github.com/EienSakura/mio",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "娱乐",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
]
|
]
|
@@ -4,7 +4,7 @@
|
|||||||
"project_link": "",
|
"project_link": "",
|
||||||
"name": "None",
|
"name": "None",
|
||||||
"desc": "None 驱动器",
|
"desc": "None 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"project_link": "nonebot2[fastapi]",
|
"project_link": "nonebot2[fastapi]",
|
||||||
"name": "FastAPI",
|
"name": "FastAPI",
|
||||||
"desc": "FastAPI 驱动器",
|
"desc": "FastAPI 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"project_link": "nonebot2[quart]",
|
"project_link": "nonebot2[quart]",
|
||||||
"name": "Quart",
|
"name": "Quart",
|
||||||
"desc": "Quart 驱动器",
|
"desc": "Quart 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"project_link": "nonebot2[httpx]",
|
"project_link": "nonebot2[httpx]",
|
||||||
"name": "HTTPX",
|
"name": "HTTPX",
|
||||||
"desc": "HTTPX 驱动器",
|
"desc": "HTTPX 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"project_link": "nonebot2[websockets]",
|
"project_link": "nonebot2[websockets]",
|
||||||
"name": "websockets",
|
"name": "websockets",
|
||||||
"desc": "websockets 驱动器",
|
"desc": "websockets 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
@@ -54,9 +54,9 @@
|
|||||||
"project_link": "nonebot2[aiohttp]",
|
"project_link": "nonebot2[aiohttp]",
|
||||||
"name": "AIOHTTP",
|
"name": "AIOHTTP",
|
||||||
"desc": "AIOHTTP 驱动器",
|
"desc": "AIOHTTP 驱动器",
|
||||||
"author": "yanyongyu",
|
"author_id": 42488585,
|
||||||
"homepage": "/docs/advanced/driver",
|
"homepage": "/docs/advanced/driver",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"is_official": true
|
"is_official": true
|
||||||
}
|
},
|
||||||
]
|
]
|
File diff suppressed because it is too large
Load Diff
1657
envs/pydantic-v1/poetry.lock
generated
1657
envs/pydantic-v1/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
1773
envs/pydantic-v2/poetry.lock
generated
1773
envs/pydantic-v2/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
1035
envs/test/poetry.lock
generated
1035
envs/test/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ python = "^3.9"
|
|||||||
trio = "^0.27.0"
|
trio = "^0.27.0"
|
||||||
nonebug = "^0.4.1"
|
nonebug = "^0.4.1"
|
||||||
wsproto = "^1.2.0"
|
wsproto = "^1.2.0"
|
||||||
pytest-cov = "^5.0.0"
|
pytest-cov = "^6.0.0"
|
||||||
pytest-xdist = "^3.0.2"
|
pytest-xdist = "^3.0.2"
|
||||||
werkzeug = ">=2.3.6,<4.0.0"
|
werkzeug = ">=2.3.6,<4.0.0"
|
||||||
coverage-conditional-plugin = "^0.9.0"
|
coverage-conditional-plugin = "^0.9.0"
|
||||||
|
@@ -45,18 +45,18 @@ FrontMatter:
|
|||||||
description: nonebot 模块
|
description: nonebot 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
from typing import Any, Union, TypeVar, Optional, overload
|
import os
|
||||||
|
from typing import Any, Optional, TypeVar, Union, overload
|
||||||
|
|
||||||
import loguru
|
import loguru
|
||||||
|
|
||||||
|
from nonebot.adapters import Adapter, Bot
|
||||||
from nonebot.compat import model_dump
|
from nonebot.compat import model_dump
|
||||||
|
from nonebot.config import DOTENV_TYPE, Config, Env
|
||||||
|
from nonebot.drivers import ASGIMixin, Driver, combine_driver
|
||||||
from nonebot.log import logger as logger
|
from nonebot.log import logger as logger
|
||||||
from nonebot.adapters import Bot, Adapter
|
|
||||||
from nonebot.config import DOTENV_TYPE, Env, Config
|
|
||||||
from nonebot.utils import escape_tag, resolve_dot_notation
|
from nonebot.utils import escape_tag, resolve_dot_notation
|
||||||
from nonebot.drivers import Driver, ASGIMixin, combine_driver
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
__version__ = version("nonebot2")
|
__version__ = version("nonebot2")
|
||||||
@@ -337,31 +337,31 @@ def run(*args: Any, **kwargs: Any) -> None:
|
|||||||
get_driver().run(*args, **kwargs)
|
get_driver().run(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
from nonebot.plugin import on as on
|
|
||||||
from nonebot.plugin import on_type as on_type
|
|
||||||
from nonebot.plugin import require as require
|
|
||||||
from nonebot.plugin import on_regex as on_regex
|
|
||||||
from nonebot.plugin import on_notice as on_notice
|
|
||||||
from nonebot.plugin import get_plugin as get_plugin
|
|
||||||
from nonebot.plugin import on_command as on_command
|
|
||||||
from nonebot.plugin import on_keyword as on_keyword
|
|
||||||
from nonebot.plugin import on_message as on_message
|
|
||||||
from nonebot.plugin import on_request as on_request
|
|
||||||
from nonebot.plugin import load_plugin as load_plugin
|
|
||||||
from nonebot.plugin import on_endswith as on_endswith
|
|
||||||
from nonebot.plugin import CommandGroup as CommandGroup
|
from nonebot.plugin import CommandGroup as CommandGroup
|
||||||
from nonebot.plugin import MatcherGroup as MatcherGroup
|
from nonebot.plugin import MatcherGroup as MatcherGroup
|
||||||
from nonebot.plugin import load_plugins as load_plugins
|
from nonebot.plugin import get_available_plugin_names as get_available_plugin_names
|
||||||
from nonebot.plugin import on_fullmatch as on_fullmatch
|
|
||||||
from nonebot.plugin import on_metaevent as on_metaevent
|
|
||||||
from nonebot.plugin import on_startswith as on_startswith
|
|
||||||
from nonebot.plugin import load_from_json as load_from_json
|
|
||||||
from nonebot.plugin import load_from_toml as load_from_toml
|
|
||||||
from nonebot.plugin import load_all_plugins as load_all_plugins
|
|
||||||
from nonebot.plugin import on_shell_command as on_shell_command
|
|
||||||
from nonebot.plugin import get_plugin_config as get_plugin_config
|
|
||||||
from nonebot.plugin import get_loaded_plugins as get_loaded_plugins
|
from nonebot.plugin import get_loaded_plugins as get_loaded_plugins
|
||||||
|
from nonebot.plugin import get_plugin as get_plugin
|
||||||
|
from nonebot.plugin import get_plugin_by_module_name as get_plugin_by_module_name
|
||||||
|
from nonebot.plugin import get_plugin_config as get_plugin_config
|
||||||
|
from nonebot.plugin import load_all_plugins as load_all_plugins
|
||||||
from nonebot.plugin import load_builtin_plugin as load_builtin_plugin
|
from nonebot.plugin import load_builtin_plugin as load_builtin_plugin
|
||||||
from nonebot.plugin import load_builtin_plugins as load_builtin_plugins
|
from nonebot.plugin import load_builtin_plugins as load_builtin_plugins
|
||||||
from nonebot.plugin import get_plugin_by_module_name as get_plugin_by_module_name
|
from nonebot.plugin import load_from_json as load_from_json
|
||||||
from nonebot.plugin import get_available_plugin_names as get_available_plugin_names
|
from nonebot.plugin import load_from_toml as load_from_toml
|
||||||
|
from nonebot.plugin import load_plugin as load_plugin
|
||||||
|
from nonebot.plugin import load_plugins as load_plugins
|
||||||
|
from nonebot.plugin import on as on
|
||||||
|
from nonebot.plugin import on_command as on_command
|
||||||
|
from nonebot.plugin import on_endswith as on_endswith
|
||||||
|
from nonebot.plugin import on_fullmatch as on_fullmatch
|
||||||
|
from nonebot.plugin import on_keyword as on_keyword
|
||||||
|
from nonebot.plugin import on_message as on_message
|
||||||
|
from nonebot.plugin import on_metaevent as on_metaevent
|
||||||
|
from nonebot.plugin import on_notice as on_notice
|
||||||
|
from nonebot.plugin import on_regex as on_regex
|
||||||
|
from nonebot.plugin import on_request as on_request
|
||||||
|
from nonebot.plugin import on_shell_command as on_shell_command
|
||||||
|
from nonebot.plugin import on_startswith as on_startswith
|
||||||
|
from nonebot.plugin import on_type as on_type
|
||||||
|
from nonebot.plugin import require as require
|
||||||
|
@@ -9,9 +9,9 @@ FrontMatter:
|
|||||||
description: nonebot.adapters 模块
|
description: nonebot.adapters 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from nonebot.internal.adapter import Adapter as Adapter
|
||||||
from nonebot.internal.adapter import Bot as Bot
|
from nonebot.internal.adapter import Bot as Bot
|
||||||
from nonebot.internal.adapter import Event as Event
|
from nonebot.internal.adapter import Event as Event
|
||||||
from nonebot.internal.adapter import Adapter as Adapter
|
|
||||||
from nonebot.internal.adapter import Message as Message
|
from nonebot.internal.adapter import Message as Message
|
||||||
from nonebot.internal.adapter import MessageSegment as MessageSegment
|
from nonebot.internal.adapter import MessageSegment as MessageSegment
|
||||||
from nonebot.internal.adapter import MessageTemplate as MessageTemplate
|
from nonebot.internal.adapter import MessageTemplate as MessageTemplate
|
||||||
|
@@ -10,21 +10,21 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from functools import cached_property
|
|
||||||
from dataclasses import dataclass, is_dataclass
|
from dataclasses import dataclass, is_dataclass
|
||||||
from typing_extensions import Self, get_args, get_origin, is_typeddict
|
from functools import cached_property
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
|
Annotated,
|
||||||
Any,
|
Any,
|
||||||
Union,
|
|
||||||
Generic,
|
|
||||||
TypeVar,
|
|
||||||
Callable,
|
Callable,
|
||||||
|
Generic,
|
||||||
Optional,
|
Optional,
|
||||||
Protocol,
|
Protocol,
|
||||||
Annotated,
|
TypeVar,
|
||||||
|
Union,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import Self, get_args, get_origin, is_typeddict
|
||||||
|
|
||||||
from pydantic import VERSION, BaseModel
|
from pydantic import VERSION, BaseModel
|
||||||
|
|
||||||
@@ -44,21 +44,21 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"Required",
|
|
||||||
"PydanticUndefined",
|
|
||||||
"PydanticUndefinedType",
|
|
||||||
"ConfigDict",
|
|
||||||
"DEFAULT_CONFIG",
|
"DEFAULT_CONFIG",
|
||||||
|
"ConfigDict",
|
||||||
"FieldInfo",
|
"FieldInfo",
|
||||||
"ModelField",
|
"ModelField",
|
||||||
|
"PydanticUndefined",
|
||||||
|
"PydanticUndefinedType",
|
||||||
|
"Required",
|
||||||
"TypeAdapter",
|
"TypeAdapter",
|
||||||
|
"custom_validation",
|
||||||
"extract_field_info",
|
"extract_field_info",
|
||||||
"model_fields",
|
|
||||||
"model_config",
|
"model_config",
|
||||||
"model_dump",
|
"model_dump",
|
||||||
"type_validate_python",
|
"model_fields",
|
||||||
"type_validate_json",
|
"type_validate_json",
|
||||||
"custom_validation",
|
"type_validate_python",
|
||||||
)
|
)
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
@@ -70,9 +70,9 @@ __autodoc__ = {
|
|||||||
if PYDANTIC_V2: # pragma: pydantic-v2
|
if PYDANTIC_V2: # pragma: pydantic-v2
|
||||||
from pydantic import GetCoreSchemaHandler
|
from pydantic import GetCoreSchemaHandler
|
||||||
from pydantic import TypeAdapter as TypeAdapter
|
from pydantic import TypeAdapter as TypeAdapter
|
||||||
from pydantic_core import CoreSchema, core_schema
|
|
||||||
from pydantic._internal._repr import display_as_type
|
from pydantic._internal._repr import display_as_type
|
||||||
from pydantic.fields import FieldInfo as BaseFieldInfo
|
from pydantic.fields import FieldInfo as BaseFieldInfo
|
||||||
|
from pydantic_core import CoreSchema, core_schema
|
||||||
|
|
||||||
Required = Ellipsis
|
Required = Ellipsis
|
||||||
"""Alias of Ellipsis for compatibility with pydantic v1"""
|
"""Alias of Ellipsis for compatibility with pydantic v1"""
|
||||||
@@ -253,9 +253,8 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
|||||||
return class_
|
return class_
|
||||||
|
|
||||||
else: # pragma: pydantic-v1
|
else: # pragma: pydantic-v1
|
||||||
from pydantic import Extra
|
|
||||||
from pydantic import parse_obj_as, parse_raw_as
|
|
||||||
from pydantic import BaseConfig as PydanticConfig
|
from pydantic import BaseConfig as PydanticConfig
|
||||||
|
from pydantic import Extra, parse_obj_as, parse_raw_as
|
||||||
from pydantic.fields import FieldInfo as BaseFieldInfo
|
from pydantic.fields import FieldInfo as BaseFieldInfo
|
||||||
from pydantic.fields import ModelField as BaseModelField
|
from pydantic.fields import ModelField as BaseModelField
|
||||||
from pydantic.schema import get_annotation_from_field_info
|
from pydantic.schema import get_annotation_from_field_info
|
||||||
|
@@ -13,23 +13,20 @@ FrontMatter:
|
|||||||
description: nonebot.config 模块
|
description: nonebot.config 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import abc
|
import abc
|
||||||
import json
|
from collections.abc import Mapping
|
||||||
from pathlib import Path
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from ipaddress import IPv4Address
|
from ipaddress import IPv4Address
|
||||||
from collections.abc import Mapping
|
import json
|
||||||
from typing import TYPE_CHECKING, Any, Union, Optional
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
from typing_extensions import TypeAlias, get_args, get_origin
|
from typing_extensions import TypeAlias, get_args, get_origin
|
||||||
|
|
||||||
from dotenv import dotenv_values
|
from dotenv import dotenv_values
|
||||||
from pydantic import Field, BaseModel
|
from pydantic import BaseModel, Field
|
||||||
from pydantic.networks import IPvAnyAddress
|
from pydantic.networks import IPvAnyAddress
|
||||||
|
|
||||||
from nonebot.log import logger
|
|
||||||
from nonebot.typing import origin_is_union
|
|
||||||
from nonebot.utils import deep_update, type_is_complex, lenient_issubclass
|
|
||||||
from nonebot.compat import (
|
from nonebot.compat import (
|
||||||
PYDANTIC_V2,
|
PYDANTIC_V2,
|
||||||
ConfigDict,
|
ConfigDict,
|
||||||
@@ -39,6 +36,9 @@ from nonebot.compat import (
|
|||||||
model_config,
|
model_config,
|
||||||
model_fields,
|
model_fields,
|
||||||
)
|
)
|
||||||
|
from nonebot.log import logger
|
||||||
|
from nonebot.typing import origin_is_union
|
||||||
|
from nonebot.utils import deep_update, lenient_issubclass, type_is_complex
|
||||||
|
|
||||||
DOTENV_TYPE: TypeAlias = Union[
|
DOTENV_TYPE: TypeAlias = Union[
|
||||||
Path, str, list[Union[Path, str]], tuple[Union[Path, str], ...]
|
Path, str, list[Union[Path, str]], tuple[Union[Path, str], ...]
|
||||||
|
@@ -22,6 +22,10 @@ REJECT_TARGET: Literal["_current_target"] = "_current_target"
|
|||||||
"""当前 `reject` 目标存储 key"""
|
"""当前 `reject` 目标存储 key"""
|
||||||
REJECT_CACHE_TARGET: Literal["_next_target"] = "_next_target"
|
REJECT_CACHE_TARGET: Literal["_next_target"] = "_next_target"
|
||||||
"""下一个 `reject` 目标存储 key"""
|
"""下一个 `reject` 目标存储 key"""
|
||||||
|
PAUSE_PROMPT_RESULT_KEY: Literal["_pause_result"] = "_pause_result"
|
||||||
|
"""`pause` prompt 发送结果存储 key"""
|
||||||
|
REJECT_PROMPT_RESULT_KEY: Literal["_reject_{key}_result"] = "_reject_{key}_result"
|
||||||
|
"""`reject` prompt 发送结果存储 key"""
|
||||||
|
|
||||||
# used by Rule
|
# used by Rule
|
||||||
PREFIX_KEY: Literal["_prefix"] = "_prefix"
|
PREFIX_KEY: Literal["_prefix"] = "_prefix"
|
||||||
|
@@ -8,24 +8,24 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import inspect
|
from collections.abc import Awaitable, Iterable
|
||||||
|
from dataclasses import dataclass, field
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from dataclasses import field, dataclass
|
import inspect
|
||||||
from collections.abc import Iterable, Awaitable
|
from typing import Any, Callable, Generic, Optional, TypeVar, cast
|
||||||
from typing import Any, Generic, TypeVar, Callable, Optional, cast
|
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
|
from nonebot.compat import FieldInfo, ModelField, PydanticUndefined
|
||||||
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
from nonebot.typing import _DependentCallable
|
from nonebot.typing import _DependentCallable
|
||||||
from nonebot.exception import SkippedException
|
|
||||||
from nonebot.compat import FieldInfo, ModelField, PydanticUndefined
|
|
||||||
from nonebot.utils import (
|
from nonebot.utils import (
|
||||||
run_sync,
|
|
||||||
run_coro_with_shield,
|
|
||||||
is_coroutine_callable,
|
|
||||||
flatten_exception_group,
|
flatten_exception_group,
|
||||||
|
is_coroutine_callable,
|
||||||
|
run_coro_with_shield,
|
||||||
|
run_sync,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .utils import check_field_type, get_typed_signature
|
from .utils import check_field_type, get_typed_signature
|
||||||
|
@@ -10,24 +10,24 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from nonebot.internal.driver import URL as URL
|
from nonebot.internal.driver import URL as URL
|
||||||
from nonebot.internal.driver import Mixin as Mixin
|
from nonebot.internal.driver import ASGIMixin as ASGIMixin
|
||||||
from nonebot.internal.driver import Driver as Driver
|
|
||||||
from nonebot.internal.driver import Cookies as Cookies
|
from nonebot.internal.driver import Cookies as Cookies
|
||||||
|
from nonebot.internal.driver import Driver as Driver
|
||||||
|
from nonebot.internal.driver import ForwardDriver as ForwardDriver
|
||||||
|
from nonebot.internal.driver import ForwardMixin as ForwardMixin
|
||||||
|
from nonebot.internal.driver import HTTPClientMixin as HTTPClientMixin
|
||||||
|
from nonebot.internal.driver import HTTPClientSession as HTTPClientSession
|
||||||
|
from nonebot.internal.driver import HTTPServerSetup as HTTPServerSetup
|
||||||
|
from nonebot.internal.driver import HTTPVersion as HTTPVersion
|
||||||
|
from nonebot.internal.driver import Mixin as Mixin
|
||||||
from nonebot.internal.driver import Request as Request
|
from nonebot.internal.driver import Request as Request
|
||||||
from nonebot.internal.driver import Response as Response
|
from nonebot.internal.driver import Response as Response
|
||||||
from nonebot.internal.driver import ASGIMixin as ASGIMixin
|
|
||||||
from nonebot.internal.driver import WebSocket as WebSocket
|
|
||||||
from nonebot.internal.driver import HTTPVersion as HTTPVersion
|
|
||||||
from nonebot.internal.driver import ForwardMixin as ForwardMixin
|
|
||||||
from nonebot.internal.driver import ReverseMixin as ReverseMixin
|
|
||||||
from nonebot.internal.driver import ForwardDriver as ForwardDriver
|
|
||||||
from nonebot.internal.driver import ReverseDriver as ReverseDriver
|
from nonebot.internal.driver import ReverseDriver as ReverseDriver
|
||||||
from nonebot.internal.driver import combine_driver as combine_driver
|
from nonebot.internal.driver import ReverseMixin as ReverseMixin
|
||||||
from nonebot.internal.driver import HTTPClientMixin as HTTPClientMixin
|
from nonebot.internal.driver import WebSocket as WebSocket
|
||||||
from nonebot.internal.driver import HTTPServerSetup as HTTPServerSetup
|
|
||||||
from nonebot.internal.driver import HTTPClientSession as HTTPClientSession
|
|
||||||
from nonebot.internal.driver import WebSocketClientMixin as WebSocketClientMixin
|
from nonebot.internal.driver import WebSocketClientMixin as WebSocketClientMixin
|
||||||
from nonebot.internal.driver import WebSocketServerSetup as WebSocketServerSetup
|
from nonebot.internal.driver import WebSocketServerSetup as WebSocketServerSetup
|
||||||
|
from nonebot.internal.driver import combine_driver as combine_driver
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
"URL": True,
|
"URL": True,
|
||||||
|
@@ -17,25 +17,27 @@ FrontMatter:
|
|||||||
description: nonebot.drivers.aiohttp 模块
|
description: nonebot.drivers.aiohttp 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing_extensions import override
|
|
||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from typing import TYPE_CHECKING, Union, Optional
|
from typing import TYPE_CHECKING, Optional, Union
|
||||||
|
from typing_extensions import override
|
||||||
|
|
||||||
from multidict import CIMultiDict
|
from multidict import CIMultiDict
|
||||||
|
|
||||||
from nonebot.exception import WebSocketClosed
|
|
||||||
from nonebot.drivers import URL, Request, Response
|
|
||||||
from nonebot.drivers.none import Driver as NoneDriver
|
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
|
||||||
from nonebot.internal.driver import Cookies, QueryTypes, CookieTypes, HeaderTypes
|
|
||||||
from nonebot.drivers import (
|
from nonebot.drivers import (
|
||||||
HTTPVersion,
|
URL,
|
||||||
HTTPClientMixin,
|
HTTPClientMixin,
|
||||||
HTTPClientSession,
|
HTTPClientSession,
|
||||||
|
HTTPVersion,
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
WebSocketClientMixin,
|
WebSocketClientMixin,
|
||||||
combine_driver,
|
combine_driver,
|
||||||
)
|
)
|
||||||
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
|
from nonebot.drivers.none import Driver as NoneDriver
|
||||||
|
from nonebot.exception import WebSocketClosed
|
||||||
|
from nonebot.internal.driver import Cookies, CookieTypes, HeaderTypes, QueryTypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@@ -88,9 +90,7 @@ class Session(HTTPClientSession):
|
|||||||
@override
|
@override
|
||||||
async def request(self, setup: Request) -> Response:
|
async def request(self, setup: Request) -> Response:
|
||||||
if self._params:
|
if self._params:
|
||||||
params = self._params.copy()
|
url = setup.url.with_query({**self._params, **setup.url.query})
|
||||||
params.update(setup.url.query)
|
|
||||||
url = setup.url.with_query(params)
|
|
||||||
else:
|
else:
|
||||||
url = setup.url
|
url = setup.url
|
||||||
|
|
||||||
@@ -170,11 +170,13 @@ class Mixin(HTTPClientMixin, WebSocketClientMixin):
|
|||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Unsupported HTTP version: {setup.version}")
|
raise RuntimeError(f"Unsupported HTTP version: {setup.version}")
|
||||||
|
|
||||||
|
timeout = aiohttp.ClientWSTimeout(ws_close=setup.timeout or 10.0) # type: ignore
|
||||||
|
|
||||||
async with aiohttp.ClientSession(version=version, trust_env=True) as session:
|
async with aiohttp.ClientSession(version=version, trust_env=True) as session:
|
||||||
async with session.ws_connect(
|
async with session.ws_connect(
|
||||||
setup.url,
|
setup.url,
|
||||||
method=setup.method,
|
method=setup.method,
|
||||||
timeout=setup.timeout or 10,
|
timeout=timeout,
|
||||||
headers=setup.headers,
|
headers=setup.headers,
|
||||||
proxy=setup.proxy,
|
proxy=setup.proxy,
|
||||||
) as ws:
|
) as ws:
|
||||||
|
@@ -17,30 +17,29 @@ FrontMatter:
|
|||||||
description: nonebot.drivers.fastapi 模块
|
description: nonebot.drivers.fastapi 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
|
||||||
import contextlib
|
import contextlib
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
import logging
|
||||||
|
from typing import Any, Optional, Union
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
from typing import Any, Union, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from nonebot.config import Env
|
from nonebot.compat import model_dump, type_validate_python
|
||||||
from nonebot.drivers import ASGIMixin
|
|
||||||
from nonebot.exception import WebSocketClosed
|
|
||||||
from nonebot.internal.driver import FileTypes
|
|
||||||
from nonebot.drivers import Driver as BaseDriver
|
|
||||||
from nonebot.config import Config as NoneBotConfig
|
from nonebot.config import Config as NoneBotConfig
|
||||||
|
from nonebot.config import Env
|
||||||
|
from nonebot.drivers import ASGIMixin, HTTPServerSetup, WebSocketServerSetup
|
||||||
|
from nonebot.drivers import Driver as BaseDriver
|
||||||
from nonebot.drivers import Request as BaseRequest
|
from nonebot.drivers import Request as BaseRequest
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
from nonebot.compat import model_dump, type_validate_python
|
from nonebot.exception import WebSocketClosed
|
||||||
from nonebot.drivers import HTTPServerSetup, WebSocketServerSetup
|
from nonebot.internal.driver import FileTypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uvicorn
|
|
||||||
from fastapi.responses import Response
|
|
||||||
from fastapi import FastAPI, Request, UploadFile, status
|
from fastapi import FastAPI, Request, UploadFile, status
|
||||||
from starlette.websockets import WebSocket, WebSocketState, WebSocketDisconnect
|
from fastapi.responses import Response
|
||||||
|
from starlette.websockets import WebSocket, WebSocketDisconnect, WebSocketState
|
||||||
|
import uvicorn
|
||||||
except ModuleNotFoundError as e: # pragma: no cover
|
except ModuleNotFoundError as e: # pragma: no cover
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Please install FastAPI first to use this driver. "
|
"Please install FastAPI first to use this driver. "
|
||||||
|
@@ -17,22 +17,22 @@ FrontMatter:
|
|||||||
description: nonebot.drivers.httpx 模块
|
description: nonebot.drivers.httpx 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, Optional, Union
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
from typing import TYPE_CHECKING, Union, Optional
|
|
||||||
|
|
||||||
from multidict import CIMultiDict
|
from multidict import CIMultiDict
|
||||||
|
|
||||||
from nonebot.drivers.none import Driver as NoneDriver
|
|
||||||
from nonebot.internal.driver import Cookies, QueryTypes, CookieTypes, HeaderTypes
|
|
||||||
from nonebot.drivers import (
|
from nonebot.drivers import (
|
||||||
URL,
|
URL,
|
||||||
Request,
|
|
||||||
Response,
|
|
||||||
HTTPVersion,
|
|
||||||
HTTPClientMixin,
|
HTTPClientMixin,
|
||||||
HTTPClientSession,
|
HTTPClientSession,
|
||||||
|
HTTPVersion,
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
combine_driver,
|
combine_driver,
|
||||||
)
|
)
|
||||||
|
from nonebot.drivers.none import Driver as NoneDriver
|
||||||
|
from nonebot.internal.driver import Cookies, CookieTypes, HeaderTypes, QueryTypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import httpx
|
import httpx
|
||||||
@@ -82,6 +82,8 @@ class Session(HTTPClientSession):
|
|||||||
data=setup.data,
|
data=setup.data,
|
||||||
files=setup.files,
|
files=setup.files,
|
||||||
json=setup.json,
|
json=setup.json,
|
||||||
|
# ensure the params priority
|
||||||
|
params=setup.url.raw_query_string,
|
||||||
headers=tuple(setup.headers.items()),
|
headers=tuple(setup.headers.items()),
|
||||||
cookies=setup.cookies.jar,
|
cookies=setup.cookies.jar,
|
||||||
timeout=setup.timeout,
|
timeout=setup.timeout,
|
||||||
@@ -102,7 +104,7 @@ class Session(HTTPClientSession):
|
|||||||
headers=self._headers,
|
headers=self._headers,
|
||||||
cookies=self._cookies.jar,
|
cookies=self._cookies.jar,
|
||||||
http2=self._version == HTTPVersion.H2,
|
http2=self._version == HTTPVersion.H2,
|
||||||
proxies=self._proxy,
|
proxy=self._proxy,
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
await self._client.__aenter__()
|
await self._client.__aenter__()
|
||||||
|
@@ -19,10 +19,10 @@ import anyio
|
|||||||
from anyio.abc import TaskGroup
|
from anyio.abc import TaskGroup
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.log import logger
|
from nonebot.config import Config, Env
|
||||||
from nonebot.consts import WINDOWS
|
from nonebot.consts import WINDOWS
|
||||||
from nonebot.config import Env, Config
|
|
||||||
from nonebot.drivers import Driver as BaseDriver
|
from nonebot.drivers import Driver as BaseDriver
|
||||||
|
from nonebot.log import logger
|
||||||
from nonebot.utils import flatten_exception_group
|
from nonebot.utils import flatten_exception_group
|
||||||
|
|
||||||
HANDLED_SIGNALS = (
|
HANDLED_SIGNALS = (
|
||||||
|
@@ -19,30 +19,29 @@ FrontMatter:
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
from typing import Any, Union, Optional, cast
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from nonebot.config import Env
|
from nonebot.compat import model_dump, type_validate_python
|
||||||
from nonebot.drivers import ASGIMixin
|
|
||||||
from nonebot.exception import WebSocketClosed
|
|
||||||
from nonebot.internal.driver import FileTypes
|
|
||||||
from nonebot.drivers import Driver as BaseDriver
|
|
||||||
from nonebot.config import Config as NoneBotConfig
|
from nonebot.config import Config as NoneBotConfig
|
||||||
|
from nonebot.config import Env
|
||||||
|
from nonebot.drivers import ASGIMixin, HTTPServerSetup, WebSocketServerSetup
|
||||||
|
from nonebot.drivers import Driver as BaseDriver
|
||||||
from nonebot.drivers import Request as BaseRequest
|
from nonebot.drivers import Request as BaseRequest
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
from nonebot.compat import model_dump, type_validate_python
|
from nonebot.exception import WebSocketClosed
|
||||||
from nonebot.drivers import HTTPServerSetup, WebSocketServerSetup
|
from nonebot.internal.driver import FileTypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uvicorn
|
from quart import Quart, Request, Response
|
||||||
|
from quart import Websocket as QuartWebSocket
|
||||||
from quart import request as _request
|
from quart import request as _request
|
||||||
from quart.ctx import WebsocketContext
|
from quart.ctx import WebsocketContext
|
||||||
from quart.globals import websocket_ctx
|
|
||||||
from quart import Quart, Request, Response
|
|
||||||
from quart.datastructures import FileStorage
|
from quart.datastructures import FileStorage
|
||||||
from quart import Websocket as QuartWebSocket
|
from quart.globals import websocket_ctx
|
||||||
|
import uvicorn
|
||||||
except ModuleNotFoundError as e: # pragma: no cover
|
except ModuleNotFoundError as e: # pragma: no cover
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Please install Quart first to use this driver. "
|
"Please install Quart first to use this driver. "
|
||||||
|
@@ -17,19 +17,18 @@ FrontMatter:
|
|||||||
description: nonebot.drivers.websockets 模块
|
description: nonebot.drivers.websockets 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
from collections.abc import AsyncGenerator, Coroutine
|
||||||
from functools import wraps
|
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
|
from functools import wraps
|
||||||
|
import logging
|
||||||
|
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union
|
||||||
from typing_extensions import ParamSpec, override
|
from typing_extensions import ParamSpec, override
|
||||||
from collections.abc import Coroutine, AsyncGenerator
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, TypeVar, Callable
|
|
||||||
|
|
||||||
from nonebot.drivers import Request
|
from nonebot.drivers import Request, WebSocketClientMixin, combine_driver
|
||||||
from nonebot.log import LoguruHandler
|
|
||||||
from nonebot.exception import WebSocketClosed
|
|
||||||
from nonebot.drivers.none import Driver as NoneDriver
|
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
from nonebot.drivers import WebSocketClientMixin, combine_driver
|
from nonebot.drivers.none import Driver as NoneDriver
|
||||||
|
from nonebot.exception import WebSocketClosed
|
||||||
|
from nonebot.log import LoguruHandler
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from websockets.exceptions import ConnectionClosed
|
from websockets.exceptions import ConnectionClosed
|
||||||
@@ -48,7 +47,7 @@ logger.addHandler(LoguruHandler())
|
|||||||
|
|
||||||
|
|
||||||
def catch_closed(
|
def catch_closed(
|
||||||
func: Callable[P, Coroutine[Any, Any, T]]
|
func: Callable[P, Coroutine[Any, Any, T]],
|
||||||
) -> Callable[P, Coroutine[Any, Any, T]]:
|
) -> Callable[P, Coroutine[Any, Any, T]]:
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
async def decorator(*args: P.args, **kwargs: P.kwargs) -> T:
|
async def decorator(*args: P.args, **kwargs: P.kwargs) -> T:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
from .adapter import Adapter as Adapter
|
||||||
from .bot import Bot as Bot
|
from .bot import Bot as Bot
|
||||||
from .event import Event as Event
|
from .event import Event as Event
|
||||||
from .adapter import Adapter as Adapter
|
|
||||||
from .message import Message as Message
|
from .message import Message as Message
|
||||||
from .message import MessageSegment as MessageSegment
|
from .message import MessageSegment as MessageSegment
|
||||||
from .template import MessageTemplate as MessageTemplate
|
from .template import MessageTemplate as MessageTemplate
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
import abc
|
import abc
|
||||||
from typing import Any
|
|
||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from nonebot.config import Config
|
from nonebot.config import Config
|
||||||
from nonebot.internal.driver._lifespan import LIFESPAN_FUNC
|
|
||||||
from nonebot.internal.driver import (
|
from nonebot.internal.driver import (
|
||||||
Driver,
|
|
||||||
Request,
|
|
||||||
Response,
|
|
||||||
ASGIMixin,
|
ASGIMixin,
|
||||||
WebSocket,
|
Driver,
|
||||||
HTTPClientMixin,
|
HTTPClientMixin,
|
||||||
HTTPServerSetup,
|
HTTPServerSetup,
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
|
WebSocket,
|
||||||
WebSocketClientMixin,
|
WebSocketClientMixin,
|
||||||
WebSocketServerSetup,
|
WebSocketServerSetup,
|
||||||
)
|
)
|
||||||
|
from nonebot.internal.driver._lifespan import LIFESPAN_FUNC
|
||||||
|
|
||||||
from .bot import Bot
|
from .bot import Bot
|
||||||
|
|
||||||
|
@@ -1,19 +1,19 @@
|
|||||||
import abc
|
import abc
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import TYPE_CHECKING, Any, Union, ClassVar, Optional, Protocol
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Protocol, Union
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.log import logger
|
|
||||||
from nonebot.config import Config
|
from nonebot.config import Config
|
||||||
from nonebot.exception import MockApiException
|
from nonebot.exception import MockApiException
|
||||||
from nonebot.utils import flatten_exception_group
|
from nonebot.log import logger
|
||||||
from nonebot.typing import T_CalledAPIHook, T_CallingAPIHook
|
from nonebot.typing import T_CalledAPIHook, T_CallingAPIHook
|
||||||
|
from nonebot.utils import flatten_exception_group
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .event import Event
|
|
||||||
from .adapter import Adapter
|
from .adapter import Adapter
|
||||||
|
from .event import Event
|
||||||
from .message import Message, MessageSegment
|
from .message import Message, MessageSegment
|
||||||
|
|
||||||
class _ApiCall(Protocol):
|
class _ApiCall(Protocol):
|
||||||
|
@@ -3,8 +3,8 @@ from typing import Any, TypeVar
|
|||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from nonebot.utils import DataclassEncoder
|
|
||||||
from nonebot.compat import PYDANTIC_V2, ConfigDict
|
from nonebot.compat import PYDANTIC_V2, ConfigDict
|
||||||
|
from nonebot.utils import DataclassEncoder
|
||||||
|
|
||||||
from .message import Message
|
from .message import Message
|
||||||
|
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
import abc
|
import abc
|
||||||
from copy import deepcopy
|
|
||||||
from typing_extensions import Self
|
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from dataclasses import field, asdict, dataclass
|
from copy import deepcopy
|
||||||
|
from dataclasses import asdict, dataclass, field
|
||||||
from typing import ( # noqa: UP035
|
from typing import ( # noqa: UP035
|
||||||
Any,
|
Any,
|
||||||
Type,
|
|
||||||
Union,
|
|
||||||
Generic,
|
Generic,
|
||||||
TypeVar,
|
|
||||||
Optional,
|
Optional,
|
||||||
SupportsIndex,
|
SupportsIndex,
|
||||||
|
Type,
|
||||||
|
TypeVar,
|
||||||
|
Union,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from nonebot.compat import custom_validation, type_validate_python
|
from nonebot.compat import custom_validation, type_validate_python
|
||||||
|
|
||||||
@@ -329,8 +329,9 @@ class Message(list[TMS], abc.ABC):
|
|||||||
return self[type_]
|
return self[type_]
|
||||||
|
|
||||||
iterator, filtered = (
|
iterator, filtered = (
|
||||||
seg for seg in self if seg.type == type_
|
(seg for seg in self if seg.type == type_),
|
||||||
), self.__class__()
|
self.__class__(),
|
||||||
|
)
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
seg = next(iterator, None)
|
seg = next(iterator, None)
|
||||||
if seg is None:
|
if seg is None:
|
||||||
|
@@ -1,20 +1,19 @@
|
|||||||
|
from _string import formatter_field_name_split # type: ignore
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
import functools
|
import functools
|
||||||
from string import Formatter
|
from string import Formatter
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
from collections.abc import Mapping, Sequence
|
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
Union,
|
|
||||||
Generic,
|
|
||||||
TypeVar,
|
|
||||||
Callable,
|
Callable,
|
||||||
|
Generic,
|
||||||
Optional,
|
Optional,
|
||||||
|
TypeVar,
|
||||||
|
Union,
|
||||||
cast,
|
cast,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import TypeAlias
|
||||||
from _string import formatter_field_name_split # type: ignore
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .message import Message, MessageSegment
|
from .message import Message, MessageSegment
|
||||||
|
@@ -1,31 +1,31 @@
|
|||||||
from .model import URL as URL
|
|
||||||
from .model import RawURL as RawURL
|
|
||||||
from .abstract import Mixin as Mixin
|
|
||||||
from .model import Cookies as Cookies
|
|
||||||
from .model import Request as Request
|
|
||||||
from .abstract import Driver as Driver
|
|
||||||
from .model import FileType as FileType
|
|
||||||
from .model import Response as Response
|
|
||||||
from .model import DataTypes as DataTypes
|
|
||||||
from .model import FileTypes as FileTypes
|
|
||||||
from .model import WebSocket as WebSocket
|
|
||||||
from .model import FilesTypes as FilesTypes
|
|
||||||
from .model import QueryTypes as QueryTypes
|
|
||||||
from .abstract import ASGIMixin as ASGIMixin
|
from .abstract import ASGIMixin as ASGIMixin
|
||||||
from .model import CookieTypes as CookieTypes
|
from .abstract import Driver as Driver
|
||||||
from .model import FileContent as FileContent
|
|
||||||
from .model import HTTPVersion as HTTPVersion
|
|
||||||
from .model import HeaderTypes as HeaderTypes
|
|
||||||
from .model import SimpleQuery as SimpleQuery
|
|
||||||
from .model import ContentTypes as ContentTypes
|
|
||||||
from .model import QueryVariable as QueryVariable
|
|
||||||
from .abstract import ForwardMixin as ForwardMixin
|
|
||||||
from .abstract import ReverseMixin as ReverseMixin
|
|
||||||
from .abstract import ForwardDriver as ForwardDriver
|
from .abstract import ForwardDriver as ForwardDriver
|
||||||
from .abstract import ReverseDriver as ReverseDriver
|
from .abstract import ForwardMixin as ForwardMixin
|
||||||
from .combine import combine_driver as combine_driver
|
|
||||||
from .model import HTTPServerSetup as HTTPServerSetup
|
|
||||||
from .abstract import HTTPClientMixin as HTTPClientMixin
|
from .abstract import HTTPClientMixin as HTTPClientMixin
|
||||||
from .abstract import HTTPClientSession as HTTPClientSession
|
from .abstract import HTTPClientSession as HTTPClientSession
|
||||||
from .model import WebSocketServerSetup as WebSocketServerSetup
|
from .abstract import Mixin as Mixin
|
||||||
|
from .abstract import ReverseDriver as ReverseDriver
|
||||||
|
from .abstract import ReverseMixin as ReverseMixin
|
||||||
from .abstract import WebSocketClientMixin as WebSocketClientMixin
|
from .abstract import WebSocketClientMixin as WebSocketClientMixin
|
||||||
|
from .combine import combine_driver as combine_driver
|
||||||
|
from .model import URL as URL
|
||||||
|
from .model import ContentTypes as ContentTypes
|
||||||
|
from .model import Cookies as Cookies
|
||||||
|
from .model import CookieTypes as CookieTypes
|
||||||
|
from .model import DataTypes as DataTypes
|
||||||
|
from .model import FileContent as FileContent
|
||||||
|
from .model import FilesTypes as FilesTypes
|
||||||
|
from .model import FileType as FileType
|
||||||
|
from .model import FileTypes as FileTypes
|
||||||
|
from .model import HeaderTypes as HeaderTypes
|
||||||
|
from .model import HTTPServerSetup as HTTPServerSetup
|
||||||
|
from .model import HTTPVersion as HTTPVersion
|
||||||
|
from .model import QueryTypes as QueryTypes
|
||||||
|
from .model import QueryVariable as QueryVariable
|
||||||
|
from .model import RawURL as RawURL
|
||||||
|
from .model import Request as Request
|
||||||
|
from .model import Response as Response
|
||||||
|
from .model import SimpleQuery as SimpleQuery
|
||||||
|
from .model import WebSocket as WebSocket
|
||||||
|
from .model import WebSocketServerSetup as WebSocketServerSetup
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
|
from collections.abc import Awaitable, Iterable
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
from typing import Any, Callable, Optional, Union, cast
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias
|
||||||
from collections.abc import Iterable, Awaitable
|
|
||||||
from typing import Any, Union, Callable, Optional, cast
|
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from anyio.abc import TaskGroup
|
from anyio.abc import TaskGroup
|
||||||
from exceptiongroup import suppress
|
from exceptiongroup import suppress
|
||||||
|
|
||||||
from nonebot.utils import run_sync, is_coroutine_callable
|
from nonebot.utils import is_coroutine_callable, run_sync
|
||||||
|
|
||||||
SYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Any]
|
SYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Any]
|
||||||
ASYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Awaitable[Any]]
|
ASYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Awaitable[Any]]
|
||||||
|
@@ -1,41 +1,41 @@
|
|||||||
import abc
|
import abc
|
||||||
from types import TracebackType
|
|
||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
from typing_extensions import Self, TypeAlias
|
|
||||||
from contextlib import AsyncExitStack, asynccontextmanager
|
from contextlib import AsyncExitStack, asynccontextmanager
|
||||||
from typing import TYPE_CHECKING, Any, Union, ClassVar, Optional
|
from types import TracebackType
|
||||||
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Union
|
||||||
|
from typing_extensions import Self, TypeAlias
|
||||||
|
|
||||||
from anyio.abc import TaskGroup
|
|
||||||
from anyio import CancelScope, create_task_group
|
from anyio import CancelScope, create_task_group
|
||||||
|
from anyio.abc import TaskGroup
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.log import logger
|
from nonebot.config import Config, Env
|
||||||
from nonebot.config import Env, Config
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.internal.params import BotParam, DependParam, DefaultParam
|
from nonebot.internal.params import BotParam, DefaultParam, DependParam
|
||||||
from nonebot.utils import escape_tag, run_coro_with_catch, flatten_exception_group
|
from nonebot.log import logger
|
||||||
from nonebot.typing import (
|
from nonebot.typing import (
|
||||||
T_DependencyCache,
|
|
||||||
T_BotConnectionHook,
|
T_BotConnectionHook,
|
||||||
T_BotDisconnectionHook,
|
T_BotDisconnectionHook,
|
||||||
|
T_DependencyCache,
|
||||||
)
|
)
|
||||||
|
from nonebot.utils import escape_tag, flatten_exception_group, run_coro_with_catch
|
||||||
|
|
||||||
from ._lifespan import LIFESPAN_FUNC, Lifespan
|
from ._lifespan import LIFESPAN_FUNC, Lifespan
|
||||||
from .model import (
|
from .model import (
|
||||||
|
CookieTypes,
|
||||||
|
HeaderTypes,
|
||||||
|
HTTPServerSetup,
|
||||||
|
HTTPVersion,
|
||||||
|
QueryTypes,
|
||||||
Request,
|
Request,
|
||||||
Response,
|
Response,
|
||||||
WebSocket,
|
WebSocket,
|
||||||
QueryTypes,
|
|
||||||
CookieTypes,
|
|
||||||
HeaderTypes,
|
|
||||||
HTTPVersion,
|
|
||||||
HTTPServerSetup,
|
|
||||||
WebSocketServerSetup,
|
WebSocketServerSetup,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from nonebot.internal.adapter import Bot, Adapter
|
from nonebot.internal.adapter import Adapter, Bot
|
||||||
|
|
||||||
|
|
||||||
BOT_HOOK_PARAMS = [DependParam, BotParam, DefaultParam]
|
BOT_HOOK_PARAMS = [DependParam, BotParam, DefaultParam]
|
||||||
@@ -114,7 +114,7 @@ class Driver(abc.ABC):
|
|||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
"""启动驱动框架"""
|
"""启动驱动框架"""
|
||||||
logger.opt(colors=True).debug(
|
logger.opt(colors=True).success(
|
||||||
f"<g>Loaded adapters: {escape_tag(', '.join(self._adapters))}</g>"
|
f"<g>Loaded adapters: {escape_tag(', '.join(self._adapters))}</g>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
from typing import TYPE_CHECKING, Union, TypeVar, overload
|
from typing import TYPE_CHECKING, TypeVar, Union, overload
|
||||||
|
|
||||||
from .abstract import Mixin, Driver
|
from .abstract import Driver, Mixin
|
||||||
|
|
||||||
D = TypeVar("D", bound="Driver")
|
D = TypeVar("D", bound="Driver")
|
||||||
|
|
||||||
@@ -39,6 +39,4 @@ def combine_driver(
|
|||||||
+ "+".join(x.type.__get__(self) for x in mixins) # type: ignore
|
+ "+".join(x.type.__get__(self) for x in mixins) # type: ignore
|
||||||
)
|
)
|
||||||
|
|
||||||
return type(
|
return type("CombinedDriver", (*mixins, driver), {"type": property(type_)}) # type: ignore
|
||||||
"CombinedDriver", (*mixins, driver), {"type": property(type_)}
|
|
||||||
) # type: ignore
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import abc
|
import abc
|
||||||
import urllib.request
|
from collections.abc import Awaitable, Iterator, Mapping, MutableMapping
|
||||||
from enum import Enum
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing_extensions import TypeAlias
|
from enum import Enum
|
||||||
from http.cookiejar import Cookie, CookieJar
|
from http.cookiejar import Cookie, CookieJar
|
||||||
from typing import IO, Any, Union, Callable, Optional
|
from typing import IO, Any, Callable, Optional, Union
|
||||||
from collections.abc import Mapping, Iterator, Awaitable, MutableMapping
|
from typing_extensions import TypeAlias
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
from yarl import URL as URL
|
|
||||||
from multidict import CIMultiDict
|
from multidict import CIMultiDict
|
||||||
|
from yarl import URL as URL
|
||||||
|
|
||||||
RawURL: TypeAlias = tuple[bytes, bytes, Optional[int], bytes]
|
RawURL: TypeAlias = tuple[bytes, bytes, Optional[int], bytes]
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
from .manager import MatcherManager as MatcherManager
|
from .manager import MatcherManager as MatcherManager
|
||||||
from .provider import MatcherProvider as MatcherProvider
|
|
||||||
from .provider import DEFAULT_PROVIDER_CLASS as DEFAULT_PROVIDER_CLASS
|
from .provider import DEFAULT_PROVIDER_CLASS as DEFAULT_PROVIDER_CLASS
|
||||||
|
from .provider import MatcherProvider as MatcherProvider
|
||||||
|
|
||||||
matchers = MatcherManager()
|
matchers = MatcherManager()
|
||||||
|
|
||||||
from .matcher import Matcher as Matcher
|
from .matcher import Matcher as Matcher
|
||||||
from .matcher import current_bot as current_bot
|
|
||||||
from .matcher import MatcherSource as MatcherSource
|
from .matcher import MatcherSource as MatcherSource
|
||||||
|
from .matcher import current_bot as current_bot
|
||||||
from .matcher import current_event as current_event
|
from .matcher import current_event as current_event
|
||||||
from .matcher import current_handler as current_handler
|
from .matcher import current_handler as current_handler
|
||||||
from .matcher import current_matcher as current_matcher
|
from .matcher import current_matcher as current_matcher
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from typing import TYPE_CHECKING, Union, TypeVar, Optional, overload
|
from collections.abc import ItemsView, Iterator, KeysView, MutableMapping, ValuesView
|
||||||
from collections.abc import Iterator, KeysView, ItemsView, ValuesView, MutableMapping
|
from typing import TYPE_CHECKING, Optional, TypeVar, Union, overload
|
||||||
|
|
||||||
from .provider import DEFAULT_PROVIDER_CLASS, MatcherProvider
|
from .provider import DEFAULT_PROVIDER_CLASS, MatcherProvider
|
||||||
|
|
||||||
@@ -74,9 +74,9 @@ class MatcherManager(MutableMapping[int, list[type["Matcher"]]]):
|
|||||||
self.provider.clear()
|
self.provider.clear()
|
||||||
|
|
||||||
def update( # pyright: ignore[reportIncompatibleMethodOverride]
|
def update( # pyright: ignore[reportIncompatibleMethodOverride]
|
||||||
self, __m: MutableMapping[int, list[type["Matcher"]]]
|
self, m: MutableMapping[int, list[type["Matcher"]]], /
|
||||||
) -> None:
|
) -> None:
|
||||||
self.provider.update(__m)
|
self.provider.update(m)
|
||||||
|
|
||||||
def setdefault(
|
def setdefault(
|
||||||
self, key: int, default: list[type["Matcher"]]
|
self, key: int, default: list[type["Matcher"]]
|
||||||
|
@@ -1,34 +1,46 @@
|
|||||||
import sys
|
|
||||||
import inspect
|
|
||||||
import warnings
|
|
||||||
from pathlib import Path
|
|
||||||
from types import ModuleType
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from contextvars import ContextVar
|
|
||||||
from typing_extensions import Self
|
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from datetime import datetime, timedelta
|
|
||||||
from contextlib import AsyncExitStack, contextmanager
|
from contextlib import AsyncExitStack, contextmanager
|
||||||
|
from contextvars import ContextVar
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import inspect
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
from types import ModuleType
|
||||||
from typing import ( # noqa: UP035
|
from typing import ( # noqa: UP035
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
Type,
|
|
||||||
Union,
|
|
||||||
TypeVar,
|
|
||||||
Callable,
|
Callable,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
NoReturn,
|
NoReturn,
|
||||||
Optional,
|
Optional,
|
||||||
|
Type,
|
||||||
|
TypeVar,
|
||||||
|
Union,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import Self
|
||||||
|
import warnings
|
||||||
|
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.log import logger
|
from nonebot.consts import (
|
||||||
from nonebot.internal.rule import Rule
|
ARG_KEY,
|
||||||
from nonebot.dependencies import Param, Dependent
|
LAST_RECEIVE_KEY,
|
||||||
from nonebot.internal.permission import User, Permission
|
PAUSE_PROMPT_RESULT_KEY,
|
||||||
from nonebot.utils import classproperty, flatten_exception_group
|
RECEIVE_KEY,
|
||||||
|
REJECT_CACHE_TARGET,
|
||||||
|
REJECT_PROMPT_RESULT_KEY,
|
||||||
|
REJECT_TARGET,
|
||||||
|
)
|
||||||
|
from nonebot.dependencies import Dependent, Param
|
||||||
|
from nonebot.exception import (
|
||||||
|
FinishedException,
|
||||||
|
PausedException,
|
||||||
|
RejectedException,
|
||||||
|
SkippedException,
|
||||||
|
StopPropagation,
|
||||||
|
)
|
||||||
from nonebot.internal.adapter import (
|
from nonebot.internal.adapter import (
|
||||||
Bot,
|
Bot,
|
||||||
Event,
|
Event,
|
||||||
@@ -36,37 +48,27 @@ from nonebot.internal.adapter import (
|
|||||||
MessageSegment,
|
MessageSegment,
|
||||||
MessageTemplate,
|
MessageTemplate,
|
||||||
)
|
)
|
||||||
from nonebot.typing import (
|
|
||||||
T_State,
|
|
||||||
T_Handler,
|
|
||||||
T_TypeUpdater,
|
|
||||||
T_DependencyCache,
|
|
||||||
T_PermissionUpdater,
|
|
||||||
)
|
|
||||||
from nonebot.consts import (
|
|
||||||
ARG_KEY,
|
|
||||||
RECEIVE_KEY,
|
|
||||||
REJECT_TARGET,
|
|
||||||
LAST_RECEIVE_KEY,
|
|
||||||
REJECT_CACHE_TARGET,
|
|
||||||
)
|
|
||||||
from nonebot.exception import (
|
|
||||||
PausedException,
|
|
||||||
StopPropagation,
|
|
||||||
SkippedException,
|
|
||||||
FinishedException,
|
|
||||||
RejectedException,
|
|
||||||
)
|
|
||||||
from nonebot.internal.params import (
|
from nonebot.internal.params import (
|
||||||
Depends,
|
|
||||||
ArgParam,
|
ArgParam,
|
||||||
BotParam,
|
BotParam,
|
||||||
EventParam,
|
|
||||||
StateParam,
|
|
||||||
DependParam,
|
|
||||||
DefaultParam,
|
DefaultParam,
|
||||||
|
DependParam,
|
||||||
|
Depends,
|
||||||
|
EventParam,
|
||||||
MatcherParam,
|
MatcherParam,
|
||||||
|
StateParam,
|
||||||
)
|
)
|
||||||
|
from nonebot.internal.permission import Permission, User
|
||||||
|
from nonebot.internal.rule import Rule
|
||||||
|
from nonebot.log import logger
|
||||||
|
from nonebot.typing import (
|
||||||
|
T_DependencyCache,
|
||||||
|
T_Handler,
|
||||||
|
T_PermissionUpdater,
|
||||||
|
T_State,
|
||||||
|
T_TypeUpdater,
|
||||||
|
)
|
||||||
|
from nonebot.utils import classproperty, flatten_exception_group
|
||||||
|
|
||||||
from . import matchers
|
from . import matchers
|
||||||
|
|
||||||
@@ -560,8 +562,8 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
"""
|
"""
|
||||||
bot = current_bot.get()
|
bot = current_bot.get()
|
||||||
event = current_event.get()
|
event = current_event.get()
|
||||||
state = current_matcher.get().state
|
|
||||||
if isinstance(message, MessageTemplate):
|
if isinstance(message, MessageTemplate):
|
||||||
|
state = current_matcher.get().state
|
||||||
_message = message.format(**state)
|
_message = message.format(**state)
|
||||||
else:
|
else:
|
||||||
_message = message
|
_message = message
|
||||||
@@ -597,8 +599,15 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
kwargs: {ref}`nonebot.adapters.Bot.send` 的参数,
|
kwargs: {ref}`nonebot.adapters.Bot.send` 的参数,
|
||||||
请参考对应 adapter 的 bot 对象 api
|
请参考对应 adapter 的 bot 对象 api
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
matcher = current_matcher.get()
|
||||||
|
except Exception:
|
||||||
|
matcher = None
|
||||||
|
|
||||||
if prompt is not None:
|
if prompt is not None:
|
||||||
await cls.send(prompt, **kwargs)
|
result = await cls.send(prompt, **kwargs)
|
||||||
|
if matcher is not None:
|
||||||
|
matcher.state[PAUSE_PROMPT_RESULT_KEY] = result
|
||||||
raise PausedException
|
raise PausedException
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -615,8 +624,19 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
kwargs: {ref}`nonebot.adapters.Bot.send` 的参数,
|
kwargs: {ref}`nonebot.adapters.Bot.send` 的参数,
|
||||||
请参考对应 adapter 的 bot 对象 api
|
请参考对应 adapter 的 bot 对象 api
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
matcher = current_matcher.get()
|
||||||
|
key = matcher.get_target()
|
||||||
|
except Exception:
|
||||||
|
matcher = None
|
||||||
|
key = None
|
||||||
|
|
||||||
|
key = REJECT_PROMPT_RESULT_KEY.format(key=key) if key is not None else None
|
||||||
|
|
||||||
if prompt is not None:
|
if prompt is not None:
|
||||||
await cls.send(prompt, **kwargs)
|
result = await cls.send(prompt, **kwargs)
|
||||||
|
if key is not None and matcher:
|
||||||
|
matcher.state[key] = result
|
||||||
raise RejectedException
|
raise RejectedException
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -636,9 +656,12 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
请参考对应 adapter 的 bot 对象 api
|
请参考对应 adapter 的 bot 对象 api
|
||||||
"""
|
"""
|
||||||
matcher = current_matcher.get()
|
matcher = current_matcher.get()
|
||||||
matcher.set_target(ARG_KEY.format(key=key))
|
arg_key = ARG_KEY.format(key=key)
|
||||||
|
matcher.set_target(arg_key)
|
||||||
|
|
||||||
if prompt is not None:
|
if prompt is not None:
|
||||||
await cls.send(prompt, **kwargs)
|
result = await cls.send(prompt, **kwargs)
|
||||||
|
matcher.state[REJECT_PROMPT_RESULT_KEY.format(key=arg_key)] = result
|
||||||
raise RejectedException
|
raise RejectedException
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -658,9 +681,12 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
请参考对应 adapter 的 bot 对象 api
|
请参考对应 adapter 的 bot 对象 api
|
||||||
"""
|
"""
|
||||||
matcher = current_matcher.get()
|
matcher = current_matcher.get()
|
||||||
matcher.set_target(RECEIVE_KEY.format(id=id))
|
receive_key = RECEIVE_KEY.format(id=id)
|
||||||
|
matcher.set_target(receive_key)
|
||||||
|
|
||||||
if prompt is not None:
|
if prompt is not None:
|
||||||
await cls.send(prompt, **kwargs)
|
result = await cls.send(prompt, **kwargs)
|
||||||
|
matcher.state[REJECT_PROMPT_RESULT_KEY.format(key=receive_key)] = result
|
||||||
raise RejectedException
|
raise RejectedException
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -861,7 +887,7 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
def _handle_special_exception(
|
def _handle_special_exception(
|
||||||
exc_group: BaseExceptionGroup[
|
exc_group: BaseExceptionGroup[
|
||||||
Union[FinishedException, RejectedException, PausedException]
|
Union[FinishedException, RejectedException, PausedException]
|
||||||
]
|
],
|
||||||
):
|
):
|
||||||
nonlocal exc
|
nonlocal exc
|
||||||
excs = list(flatten_exception_group(exc_group))
|
excs = list(flatten_exception_group(exc_group))
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import abc
|
import abc
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Mapping, MutableMapping
|
from collections.abc import Mapping, MutableMapping
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .matcher import Matcher
|
from .matcher import Matcher
|
||||||
|
@@ -1,46 +1,47 @@
|
|||||||
import inspect
|
from contextlib import AsyncExitStack, asynccontextmanager, contextmanager
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing_extensions import Self, get_args, override, get_origin
|
import inspect
|
||||||
from contextlib import AsyncExitStack, contextmanager, asynccontextmanager
|
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
|
||||||
Union,
|
|
||||||
Literal,
|
|
||||||
Callable,
|
|
||||||
Optional,
|
|
||||||
Annotated,
|
Annotated,
|
||||||
|
Any,
|
||||||
|
Callable,
|
||||||
|
Literal,
|
||||||
|
Optional,
|
||||||
|
Union,
|
||||||
cast,
|
cast,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import Self, get_args, get_origin, override
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
from pydantic.fields import FieldInfo as PydanticFieldInfo
|
from pydantic.fields import FieldInfo as PydanticFieldInfo
|
||||||
|
|
||||||
from nonebot.exception import SkippedException
|
|
||||||
from nonebot.dependencies import Param, Dependent
|
|
||||||
from nonebot.dependencies.utils import check_field_type
|
|
||||||
from nonebot.compat import FieldInfo, ModelField, PydanticUndefined, extract_field_info
|
from nonebot.compat import FieldInfo, ModelField, PydanticUndefined, extract_field_info
|
||||||
|
from nonebot.consts import ARG_KEY, REJECT_PROMPT_RESULT_KEY
|
||||||
|
from nonebot.dependencies import Dependent, Param
|
||||||
|
from nonebot.dependencies.utils import check_field_type
|
||||||
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.typing import (
|
from nonebot.typing import (
|
||||||
_STATE_FLAG,
|
_STATE_FLAG,
|
||||||
T_State,
|
|
||||||
T_Handler,
|
|
||||||
T_DependencyCache,
|
T_DependencyCache,
|
||||||
|
T_Handler,
|
||||||
|
T_State,
|
||||||
origin_is_annotated,
|
origin_is_annotated,
|
||||||
)
|
)
|
||||||
from nonebot.utils import (
|
from nonebot.utils import (
|
||||||
|
generic_check_issubclass,
|
||||||
get_name,
|
get_name,
|
||||||
run_sync,
|
|
||||||
is_gen_callable,
|
|
||||||
run_sync_ctx_manager,
|
|
||||||
is_async_gen_callable,
|
is_async_gen_callable,
|
||||||
is_coroutine_callable,
|
is_coroutine_callable,
|
||||||
generic_check_issubclass,
|
is_gen_callable,
|
||||||
|
run_sync,
|
||||||
|
run_sync_ctx_manager,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from nonebot.adapters import Bot, Event, Message
|
||||||
from nonebot.matcher import Matcher
|
from nonebot.matcher import Matcher
|
||||||
from nonebot.adapters import Bot, Event
|
|
||||||
|
|
||||||
|
|
||||||
class DependsInner:
|
class DependsInner:
|
||||||
@@ -522,10 +523,10 @@ class MatcherParam(Param):
|
|||||||
|
|
||||||
class ArgInner:
|
class ArgInner:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, key: Optional[str], type: Literal["message", "str", "plaintext"]
|
self, key: Optional[str], type: Literal["message", "str", "plaintext", "prompt"]
|
||||||
) -> None:
|
) -> None:
|
||||||
self.key: Optional[str] = key
|
self.key: Optional[str] = key
|
||||||
self.type: Literal["message", "str", "plaintext"] = type
|
self.type: Literal["message", "str", "plaintext", "prompt"] = type
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"ArgInner(key={self.key!r}, type={self.type!r})"
|
return f"ArgInner(key={self.key!r}, type={self.type!r})"
|
||||||
@@ -546,6 +547,11 @@ def ArgPlainText(key: Optional[str] = None) -> str:
|
|||||||
return ArgInner(key, "plaintext") # type: ignore
|
return ArgInner(key, "plaintext") # type: ignore
|
||||||
|
|
||||||
|
|
||||||
|
def ArgPromptResult(key: Optional[str] = None) -> Any:
|
||||||
|
"""`arg` prompt 发送结果"""
|
||||||
|
return ArgInner(key, "prompt")
|
||||||
|
|
||||||
|
|
||||||
class ArgParam(Param):
|
class ArgParam(Param):
|
||||||
"""Arg 注入参数
|
"""Arg 注入参数
|
||||||
|
|
||||||
@@ -559,7 +565,7 @@ class ArgParam(Param):
|
|||||||
self,
|
self,
|
||||||
*args,
|
*args,
|
||||||
key: str,
|
key: str,
|
||||||
type: Literal["message", "str", "plaintext"],
|
type: Literal["message", "str", "plaintext", "prompt"],
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@@ -584,15 +590,32 @@ class ArgParam(Param):
|
|||||||
async def _solve( # pyright: ignore[reportIncompatibleMethodOverride]
|
async def _solve( # pyright: ignore[reportIncompatibleMethodOverride]
|
||||||
self, matcher: "Matcher", **kwargs: Any
|
self, matcher: "Matcher", **kwargs: Any
|
||||||
) -> Any:
|
) -> Any:
|
||||||
message = matcher.get_arg(self.key)
|
|
||||||
if message is None:
|
|
||||||
return message
|
|
||||||
if self.type == "message":
|
if self.type == "message":
|
||||||
return message
|
return self._solve_message(matcher)
|
||||||
elif self.type == "str":
|
elif self.type == "str":
|
||||||
return str(message)
|
return self._solve_str(matcher)
|
||||||
|
elif self.type == "plaintext":
|
||||||
|
return self._solve_plaintext(matcher)
|
||||||
|
elif self.type == "prompt":
|
||||||
|
return self._solve_prompt(matcher)
|
||||||
else:
|
else:
|
||||||
return message.extract_plain_text()
|
raise ValueError(f"Unknown Arg type: {self.type}")
|
||||||
|
|
||||||
|
def _solve_message(self, matcher: "Matcher") -> Optional["Message"]:
|
||||||
|
return matcher.get_arg(self.key)
|
||||||
|
|
||||||
|
def _solve_str(self, matcher: "Matcher") -> Optional[str]:
|
||||||
|
message = matcher.get_arg(self.key)
|
||||||
|
return str(message) if message is not None else None
|
||||||
|
|
||||||
|
def _solve_plaintext(self, matcher: "Matcher") -> Optional[str]:
|
||||||
|
message = matcher.get_arg(self.key)
|
||||||
|
return message.extract_plain_text() if message is not None else None
|
||||||
|
|
||||||
|
def _solve_prompt(self, matcher: "Matcher") -> Optional[Any]:
|
||||||
|
return matcher.state.get(
|
||||||
|
REJECT_PROMPT_RESULT_KEY.format(key=ARG_KEY.format(key=self.key))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExceptionParam(Param):
|
class ExceptionParam(Param):
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
from typing_extensions import Self
|
|
||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
from typing import Union, ClassVar, NoReturn, Optional
|
from typing import ClassVar, NoReturn, Optional, Union
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.utils import run_coro_with_catch
|
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.typing import T_DependencyCache, T_PermissionChecker
|
from nonebot.typing import T_DependencyCache, T_PermissionChecker
|
||||||
|
from nonebot.utils import run_coro_with_catch
|
||||||
|
|
||||||
from .adapter import Bot, Event
|
from .adapter import Bot, Event
|
||||||
from .params import Param, BotParam, EventParam, DependParam, DefaultParam
|
from .params import BotParam, DefaultParam, DependParam, EventParam, Param
|
||||||
|
|
||||||
|
|
||||||
class Permission:
|
class Permission:
|
||||||
@@ -124,7 +124,7 @@ class User:
|
|||||||
perm: 需同时满足的权限
|
perm: 需同时满足的权限
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ("users", "perm")
|
__slots__ = ("perm", "users")
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, users: tuple[str, ...], perm: Optional[Permission] = None
|
self, users: tuple[str, ...], perm: Optional[Permission] = None
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
from typing import Union, ClassVar, NoReturn, Optional
|
from typing import ClassVar, NoReturn, Optional, Union
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.typing import T_State, T_RuleChecker, T_DependencyCache
|
from nonebot.typing import T_DependencyCache, T_RuleChecker, T_State
|
||||||
|
|
||||||
from .adapter import Bot, Event
|
from .adapter import Bot, Event
|
||||||
from .params import Param, BotParam, EventParam, StateParam, DependParam, DefaultParam
|
from .params import BotParam, DefaultParam, DependParam, EventParam, Param, StateParam
|
||||||
|
|
||||||
|
|
||||||
class Rule:
|
class Rule:
|
||||||
|
@@ -14,9 +14,9 @@ FrontMatter:
|
|||||||
description: nonebot.log 模块
|
description: nonebot.log 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import loguru
|
import loguru
|
||||||
|
@@ -7,16 +7,16 @@ FrontMatter:
|
|||||||
description: nonebot.matcher 模块
|
description: nonebot.matcher 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from nonebot.internal.matcher import DEFAULT_PROVIDER_CLASS as DEFAULT_PROVIDER_CLASS
|
||||||
from nonebot.internal.matcher import Matcher as Matcher
|
from nonebot.internal.matcher import Matcher as Matcher
|
||||||
from nonebot.internal.matcher import matchers as matchers
|
|
||||||
from nonebot.internal.matcher import current_bot as current_bot
|
|
||||||
from nonebot.internal.matcher import MatcherSource as MatcherSource
|
|
||||||
from nonebot.internal.matcher import current_event as current_event
|
|
||||||
from nonebot.internal.matcher import MatcherManager as MatcherManager
|
from nonebot.internal.matcher import MatcherManager as MatcherManager
|
||||||
from nonebot.internal.matcher import MatcherProvider as MatcherProvider
|
from nonebot.internal.matcher import MatcherProvider as MatcherProvider
|
||||||
|
from nonebot.internal.matcher import MatcherSource as MatcherSource
|
||||||
|
from nonebot.internal.matcher import current_bot as current_bot
|
||||||
|
from nonebot.internal.matcher import current_event as current_event
|
||||||
from nonebot.internal.matcher import current_handler as current_handler
|
from nonebot.internal.matcher import current_handler as current_handler
|
||||||
from nonebot.internal.matcher import current_matcher as current_matcher
|
from nonebot.internal.matcher import current_matcher as current_matcher
|
||||||
from nonebot.internal.matcher import DEFAULT_PROVIDER_CLASS as DEFAULT_PROVIDER_CLASS
|
from nonebot.internal.matcher import matchers as matchers
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
"Matcher": True,
|
"Matcher": True,
|
||||||
|
@@ -10,46 +10,46 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
from datetime import datetime
|
|
||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
|
from datetime import datetime
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Optional
|
from typing import TYPE_CHECKING, Any, Callable, Optional
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
|
||||||
from nonebot.log import logger
|
|
||||||
from nonebot.rule import TrieRule
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.matcher import Matcher, matchers
|
|
||||||
from nonebot.exception import (
|
from nonebot.exception import (
|
||||||
NoLogException,
|
|
||||||
StopPropagation,
|
|
||||||
IgnoredException,
|
IgnoredException,
|
||||||
|
NoLogException,
|
||||||
SkippedException,
|
SkippedException,
|
||||||
)
|
StopPropagation,
|
||||||
from nonebot.utils import (
|
|
||||||
escape_tag,
|
|
||||||
run_coro_with_catch,
|
|
||||||
run_coro_with_shield,
|
|
||||||
flatten_exception_group,
|
|
||||||
)
|
|
||||||
from nonebot.typing import (
|
|
||||||
T_State,
|
|
||||||
T_DependencyCache,
|
|
||||||
T_RunPreProcessor,
|
|
||||||
T_RunPostProcessor,
|
|
||||||
T_EventPreProcessor,
|
|
||||||
T_EventPostProcessor,
|
|
||||||
)
|
)
|
||||||
from nonebot.internal.params import (
|
from nonebot.internal.params import (
|
||||||
ArgParam,
|
ArgParam,
|
||||||
BotParam,
|
BotParam,
|
||||||
EventParam,
|
|
||||||
StateParam,
|
|
||||||
DependParam,
|
|
||||||
DefaultParam,
|
DefaultParam,
|
||||||
MatcherParam,
|
DependParam,
|
||||||
|
EventParam,
|
||||||
ExceptionParam,
|
ExceptionParam,
|
||||||
|
MatcherParam,
|
||||||
|
StateParam,
|
||||||
|
)
|
||||||
|
from nonebot.log import logger
|
||||||
|
from nonebot.matcher import Matcher, matchers
|
||||||
|
from nonebot.rule import TrieRule
|
||||||
|
from nonebot.typing import (
|
||||||
|
T_DependencyCache,
|
||||||
|
T_EventPostProcessor,
|
||||||
|
T_EventPreProcessor,
|
||||||
|
T_RunPostProcessor,
|
||||||
|
T_RunPreProcessor,
|
||||||
|
T_State,
|
||||||
|
)
|
||||||
|
from nonebot.utils import (
|
||||||
|
escape_tag,
|
||||||
|
flatten_exception_group,
|
||||||
|
run_coro_with_catch,
|
||||||
|
run_coro_with_shield,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@@ -8,38 +8,42 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from re import Match
|
from re import Match
|
||||||
from typing import Any, Union, Literal, Callable, Optional, overload
|
from typing import Any, Callable, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
from nonebot.matcher import Matcher
|
|
||||||
from nonebot.internal.params import Arg as Arg
|
|
||||||
from nonebot.internal.params import ArgStr as ArgStr
|
|
||||||
from nonebot.internal.params import Depends as Depends
|
|
||||||
from nonebot.internal.params import ArgParam as ArgParam
|
|
||||||
from nonebot.internal.params import BotParam as BotParam
|
|
||||||
from nonebot.adapters import Event, Message, MessageSegment
|
from nonebot.adapters import Event, Message, MessageSegment
|
||||||
from nonebot.internal.params import EventParam as EventParam
|
|
||||||
from nonebot.internal.params import StateParam as StateParam
|
|
||||||
from nonebot.internal.params import DependParam as DependParam
|
|
||||||
from nonebot.internal.params import ArgPlainText as ArgPlainText
|
|
||||||
from nonebot.internal.params import DefaultParam as DefaultParam
|
|
||||||
from nonebot.internal.params import MatcherParam as MatcherParam
|
|
||||||
from nonebot.internal.params import ExceptionParam as ExceptionParam
|
|
||||||
from nonebot.consts import (
|
from nonebot.consts import (
|
||||||
|
CMD_ARG_KEY,
|
||||||
CMD_KEY,
|
CMD_KEY,
|
||||||
|
CMD_START_KEY,
|
||||||
|
CMD_WHITESPACE_KEY,
|
||||||
|
ENDSWITH_KEY,
|
||||||
|
FULLMATCH_KEY,
|
||||||
|
KEYWORD_KEY,
|
||||||
|
PAUSE_PROMPT_RESULT_KEY,
|
||||||
PREFIX_KEY,
|
PREFIX_KEY,
|
||||||
|
RAW_CMD_KEY,
|
||||||
|
RECEIVE_KEY,
|
||||||
|
REGEX_MATCHED,
|
||||||
|
REJECT_PROMPT_RESULT_KEY,
|
||||||
SHELL_ARGS,
|
SHELL_ARGS,
|
||||||
SHELL_ARGV,
|
SHELL_ARGV,
|
||||||
CMD_ARG_KEY,
|
|
||||||
KEYWORD_KEY,
|
|
||||||
RAW_CMD_KEY,
|
|
||||||
ENDSWITH_KEY,
|
|
||||||
CMD_START_KEY,
|
|
||||||
FULLMATCH_KEY,
|
|
||||||
REGEX_MATCHED,
|
|
||||||
STARTSWITH_KEY,
|
STARTSWITH_KEY,
|
||||||
CMD_WHITESPACE_KEY,
|
|
||||||
)
|
)
|
||||||
|
from nonebot.internal.params import Arg as Arg
|
||||||
|
from nonebot.internal.params import ArgParam as ArgParam
|
||||||
|
from nonebot.internal.params import ArgPlainText as ArgPlainText
|
||||||
|
from nonebot.internal.params import ArgPromptResult as ArgPromptResult
|
||||||
|
from nonebot.internal.params import ArgStr as ArgStr
|
||||||
|
from nonebot.internal.params import BotParam as BotParam
|
||||||
|
from nonebot.internal.params import DefaultParam as DefaultParam
|
||||||
|
from nonebot.internal.params import DependParam as DependParam
|
||||||
|
from nonebot.internal.params import Depends as Depends
|
||||||
|
from nonebot.internal.params import EventParam as EventParam
|
||||||
|
from nonebot.internal.params import ExceptionParam as ExceptionParam
|
||||||
|
from nonebot.internal.params import MatcherParam as MatcherParam
|
||||||
|
from nonebot.internal.params import StateParam as StateParam
|
||||||
|
from nonebot.matcher import Matcher
|
||||||
|
from nonebot.typing import T_State
|
||||||
|
|
||||||
|
|
||||||
async def _event_type(event: Event) -> str:
|
async def _event_type(event: Event) -> str:
|
||||||
@@ -151,7 +155,7 @@ def RegexMatched() -> Match[str]:
|
|||||||
|
|
||||||
|
|
||||||
def _regex_str(
|
def _regex_str(
|
||||||
groups: tuple[Union[str, int], ...]
|
groups: tuple[Union[str, int], ...],
|
||||||
) -> Callable[[T_State], Union[str, tuple[Union[str, Any], ...], Any]]:
|
) -> Callable[[T_State], Union[str, tuple[Union[str, Any], ...], Any]]:
|
||||||
def _regex_str_dependency(
|
def _regex_str_dependency(
|
||||||
state: T_State,
|
state: T_State,
|
||||||
@@ -162,16 +166,16 @@ def _regex_str(
|
|||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def RegexStr(__group: Literal[0] = 0) -> str: ...
|
def RegexStr(group: Literal[0] = 0, /) -> str: ...
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def RegexStr(__group: Union[str, int]) -> Union[str, Any]: ...
|
def RegexStr(group: Union[str, int], /) -> Union[str, Any]: ...
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def RegexStr(
|
def RegexStr(
|
||||||
__group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int]
|
group1: Union[str, int], group2: Union[str, int], /, *groups: Union[str, int]
|
||||||
) -> tuple[Union[str, Any], ...]: ...
|
) -> tuple[Union[str, Any], ...]: ...
|
||||||
|
|
||||||
|
|
||||||
@@ -252,6 +256,26 @@ def LastReceived(default: Any = None) -> Any:
|
|||||||
return Depends(_last_received, use_cache=False)
|
return Depends(_last_received, use_cache=False)
|
||||||
|
|
||||||
|
|
||||||
|
def ReceivePromptResult(id: Optional[str] = None) -> Any:
|
||||||
|
"""`receive` prompt 发送结果"""
|
||||||
|
|
||||||
|
def _receive_prompt_result(matcher: "Matcher") -> Any:
|
||||||
|
return matcher.state.get(
|
||||||
|
REJECT_PROMPT_RESULT_KEY.format(key=RECEIVE_KEY.format(id=id))
|
||||||
|
)
|
||||||
|
|
||||||
|
return Depends(_receive_prompt_result, use_cache=False)
|
||||||
|
|
||||||
|
|
||||||
|
def PausePromptResult() -> Any:
|
||||||
|
"""`pause` prompt 发送结果"""
|
||||||
|
|
||||||
|
def _pause_prompt_result(matcher: "Matcher") -> Any:
|
||||||
|
return matcher.state.get(PAUSE_PROMPT_RESULT_KEY)
|
||||||
|
|
||||||
|
return Depends(_pause_prompt_result, use_cache=False)
|
||||||
|
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
"Arg": True,
|
"Arg": True,
|
||||||
"ArgStr": True,
|
"ArgStr": True,
|
||||||
@@ -265,4 +289,5 @@ __autodoc__ = {
|
|||||||
"DefaultParam": True,
|
"DefaultParam": True,
|
||||||
"MatcherParam": True,
|
"MatcherParam": True,
|
||||||
"ExceptionParam": True,
|
"ExceptionParam": True,
|
||||||
|
"ArgPromptResult": True,
|
||||||
}
|
}
|
||||||
|
@@ -11,11 +11,11 @@ FrontMatter:
|
|||||||
description: nonebot.permission 模块
|
description: nonebot.permission 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from nonebot.params import EventType
|
|
||||||
from nonebot.adapters import Bot, Event
|
from nonebot.adapters import Bot, Event
|
||||||
from nonebot.internal.permission import USER as USER
|
from nonebot.internal.permission import USER as USER
|
||||||
from nonebot.internal.permission import User as User
|
|
||||||
from nonebot.internal.permission import Permission as Permission
|
from nonebot.internal.permission import Permission as Permission
|
||||||
|
from nonebot.internal.permission import User as User
|
||||||
|
from nonebot.params import EventType
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
|
@@ -38,10 +38,10 @@ FrontMatter:
|
|||||||
description: nonebot.plugin 模块
|
description: nonebot.plugin 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from contextvars import ContextVar
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from contextvars import ContextVar
|
from typing import Optional, TypeVar
|
||||||
from typing import TypeVar, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
@@ -175,30 +175,30 @@ def get_plugin_config(config: type[C]) -> C:
|
|||||||
return type_validate_python(config, model_dump(get_driver().config))
|
return type_validate_python(config, model_dump(get_driver().config))
|
||||||
|
|
||||||
|
|
||||||
from .on import on as on
|
from .load import inherit_supported_adapters as inherit_supported_adapters
|
||||||
from .manager import PluginManager
|
|
||||||
from .on import on_type as on_type
|
|
||||||
from .model import Plugin as Plugin
|
|
||||||
from .load import require as require
|
|
||||||
from .on import on_regex as on_regex
|
|
||||||
from .on import on_notice as on_notice
|
|
||||||
from .on import on_command as on_command
|
|
||||||
from .on import on_keyword as on_keyword
|
|
||||||
from .on import on_message as on_message
|
|
||||||
from .on import on_request as on_request
|
|
||||||
from .on import on_endswith as on_endswith
|
|
||||||
from .load import load_plugin as load_plugin
|
|
||||||
from .on import CommandGroup as CommandGroup
|
|
||||||
from .on import MatcherGroup as MatcherGroup
|
|
||||||
from .on import on_fullmatch as on_fullmatch
|
|
||||||
from .on import on_metaevent as on_metaevent
|
|
||||||
from .load import load_plugins as load_plugins
|
|
||||||
from .on import on_startswith as on_startswith
|
|
||||||
from .load import load_from_json as load_from_json
|
|
||||||
from .load import load_from_toml as load_from_toml
|
|
||||||
from .model import PluginMetadata as PluginMetadata
|
|
||||||
from .on import on_shell_command as on_shell_command
|
|
||||||
from .load import load_all_plugins as load_all_plugins
|
from .load import load_all_plugins as load_all_plugins
|
||||||
from .load import load_builtin_plugin as load_builtin_plugin
|
from .load import load_builtin_plugin as load_builtin_plugin
|
||||||
from .load import load_builtin_plugins as load_builtin_plugins
|
from .load import load_builtin_plugins as load_builtin_plugins
|
||||||
from .load import inherit_supported_adapters as inherit_supported_adapters
|
from .load import load_from_json as load_from_json
|
||||||
|
from .load import load_from_toml as load_from_toml
|
||||||
|
from .load import load_plugin as load_plugin
|
||||||
|
from .load import load_plugins as load_plugins
|
||||||
|
from .load import require as require
|
||||||
|
from .manager import PluginManager
|
||||||
|
from .model import Plugin as Plugin
|
||||||
|
from .model import PluginMetadata as PluginMetadata
|
||||||
|
from .on import CommandGroup as CommandGroup
|
||||||
|
from .on import MatcherGroup as MatcherGroup
|
||||||
|
from .on import on as on
|
||||||
|
from .on import on_command as on_command
|
||||||
|
from .on import on_endswith as on_endswith
|
||||||
|
from .on import on_fullmatch as on_fullmatch
|
||||||
|
from .on import on_keyword as on_keyword
|
||||||
|
from .on import on_message as on_message
|
||||||
|
from .on import on_metaevent as on_metaevent
|
||||||
|
from .on import on_notice as on_notice
|
||||||
|
from .on import on_regex as on_regex
|
||||||
|
from .on import on_request as on_request
|
||||||
|
from .on import on_shell_command as on_shell_command
|
||||||
|
from .on import on_startswith as on_startswith
|
||||||
|
from .on import on_type as on_type
|
||||||
|
@@ -7,17 +7,17 @@ FrontMatter:
|
|||||||
description: nonebot.plugin.load 模块
|
description: nonebot.plugin.load 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from collections.abc import Iterable
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Union, Optional
|
from typing import Optional, Union
|
||||||
from collections.abc import Iterable
|
|
||||||
|
|
||||||
from nonebot.utils import path_to_module_name
|
from nonebot.utils import path_to_module_name
|
||||||
|
|
||||||
from .model import Plugin
|
from . import _managers, _module_name_to_plugin_id, get_plugin
|
||||||
from .manager import PluginManager
|
from .manager import PluginManager
|
||||||
from . import _managers, get_plugin, _module_name_to_plugin_id
|
from .model import Plugin
|
||||||
|
|
||||||
try: # pragma: py-gte-311
|
try: # pragma: py-gte-311
|
||||||
import tomllib # pyright: ignore[reportMissingImports]
|
import tomllib # pyright: ignore[reportMissingImports]
|
||||||
|
@@ -9,28 +9,28 @@ FrontMatter:
|
|||||||
description: nonebot.plugin.manager 模块
|
description: nonebot.plugin.manager 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import pkgutil
|
|
||||||
import importlib
|
|
||||||
from pathlib import Path
|
|
||||||
from itertools import chain
|
|
||||||
from typing import Optional
|
|
||||||
from types import ModuleType
|
|
||||||
from importlib.abc import MetaPathFinder
|
|
||||||
from collections.abc import Iterable, Sequence
|
from collections.abc import Iterable, Sequence
|
||||||
|
import importlib
|
||||||
|
from importlib.abc import MetaPathFinder
|
||||||
from importlib.machinery import PathFinder, SourceFileLoader
|
from importlib.machinery import PathFinder, SourceFileLoader
|
||||||
|
from itertools import chain
|
||||||
|
from pathlib import Path
|
||||||
|
import pkgutil
|
||||||
|
import sys
|
||||||
|
from types import ModuleType
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
from nonebot.utils import escape_tag, path_to_module_name
|
from nonebot.utils import escape_tag, path_to_module_name
|
||||||
|
|
||||||
from .model import Plugin, PluginMetadata
|
|
||||||
from . import (
|
from . import (
|
||||||
|
_current_plugin,
|
||||||
_managers,
|
_managers,
|
||||||
|
_module_name_to_plugin_id,
|
||||||
_new_plugin,
|
_new_plugin,
|
||||||
_revert_plugin,
|
_revert_plugin,
|
||||||
_current_plugin,
|
|
||||||
_module_name_to_plugin_id,
|
|
||||||
)
|
)
|
||||||
|
from .model import Plugin, PluginMetadata
|
||||||
|
|
||||||
|
|
||||||
class PluginManager:
|
class PluginManager:
|
||||||
|
@@ -8,9 +8,9 @@ FrontMatter:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
from dataclasses import dataclass, field
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from dataclasses import field, dataclass
|
from typing import TYPE_CHECKING, Any, Optional, Type # noqa: UP035
|
||||||
from typing import TYPE_CHECKING, Any, Type, Optional # noqa: UP035
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@@ -7,34 +7,34 @@ FrontMatter:
|
|||||||
description: nonebot.plugin.on 模块
|
description: nonebot.plugin.on 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
|
||||||
import inspect
|
|
||||||
import warnings
|
|
||||||
from types import ModuleType
|
|
||||||
from typing import Any, Union, Optional
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
import inspect
|
||||||
|
import re
|
||||||
|
from types import ModuleType
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
import warnings
|
||||||
|
|
||||||
from nonebot.adapters import Event
|
from nonebot.adapters import Event
|
||||||
from nonebot.permission import Permission
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.matcher import Matcher, MatcherSource
|
from nonebot.matcher import Matcher, MatcherSource
|
||||||
from nonebot.typing import T_State, T_Handler, T_RuleChecker, T_PermissionChecker
|
from nonebot.permission import Permission
|
||||||
from nonebot.rule import (
|
from nonebot.rule import (
|
||||||
Rule,
|
|
||||||
ArgumentParser,
|
ArgumentParser,
|
||||||
regex,
|
Rule,
|
||||||
command,
|
command,
|
||||||
is_type,
|
|
||||||
keyword,
|
|
||||||
endswith,
|
endswith,
|
||||||
fullmatch,
|
fullmatch,
|
||||||
startswith,
|
is_type,
|
||||||
|
keyword,
|
||||||
|
regex,
|
||||||
shell_command,
|
shell_command,
|
||||||
|
startswith,
|
||||||
)
|
)
|
||||||
|
from nonebot.typing import T_Handler, T_PermissionChecker, T_RuleChecker, T_State
|
||||||
|
|
||||||
from .model import Plugin
|
|
||||||
from .manager import _current_plugin
|
|
||||||
from . import get_plugin_by_module_name
|
from . import get_plugin_by_module_name
|
||||||
|
from .manager import _current_plugin
|
||||||
|
from .model import Plugin
|
||||||
|
|
||||||
|
|
||||||
def store_matcher(matcher: type[Matcher]) -> None:
|
def store_matcher(matcher: type[Matcher]) -> None:
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import re
|
|
||||||
from typing import Any
|
|
||||||
from types import ModuleType
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
import re
|
||||||
|
from types import ModuleType
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from nonebot.adapters import Event
|
from nonebot.adapters import Event
|
||||||
from nonebot.permission import Permission
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.rule import Rule, ArgumentParser
|
|
||||||
from nonebot.matcher import Matcher, MatcherSource
|
from nonebot.matcher import Matcher, MatcherSource
|
||||||
from nonebot.typing import T_State, T_Handler, T_RuleChecker, T_PermissionChecker
|
from nonebot.permission import Permission
|
||||||
|
from nonebot.rule import ArgumentParser, Rule
|
||||||
|
from nonebot.typing import T_Handler, T_PermissionChecker, T_RuleChecker, T_State
|
||||||
|
|
||||||
from .model import Plugin
|
from .model import Plugin
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
from nonebot import on_command
|
from nonebot import on_command
|
||||||
from nonebot.rule import to_me
|
|
||||||
from nonebot.adapters import Message
|
from nonebot.adapters import Message
|
||||||
from nonebot.params import CommandArg
|
from nonebot.params import CommandArg
|
||||||
from nonebot.plugin import PluginMetadata
|
from nonebot.plugin import PluginMetadata
|
||||||
|
from nonebot.rule import to_me
|
||||||
|
|
||||||
__plugin_meta__ = PluginMetadata(
|
__plugin_meta__ = PluginMetadata(
|
||||||
name="echo",
|
name="echo",
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
|
|
||||||
from nonebot.adapters import Event
|
from nonebot.adapters import Event
|
||||||
|
from nonebot.message import IgnoredException, event_preprocessor
|
||||||
from nonebot.params import Depends
|
from nonebot.params import Depends
|
||||||
from nonebot.plugin import PluginMetadata
|
from nonebot.plugin import PluginMetadata
|
||||||
from nonebot.message import IgnoredException, event_preprocessor
|
|
||||||
|
|
||||||
__plugin_meta__ = PluginMetadata(
|
__plugin_meta__ = PluginMetadata(
|
||||||
name="唯一会话",
|
name="唯一会话",
|
||||||
|
@@ -11,24 +11,23 @@ FrontMatter:
|
|||||||
description: nonebot.rule 模块
|
description: nonebot.rule 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from argparse import Action, ArgumentError
|
||||||
|
from argparse import ArgumentParser as ArgParser
|
||||||
|
from argparse import Namespace as Namespace
|
||||||
|
from collections.abc import Sequence
|
||||||
|
from contextvars import ContextVar
|
||||||
|
from gettext import gettext
|
||||||
|
from itertools import chain, product
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
from argparse import Action
|
|
||||||
from gettext import gettext
|
|
||||||
from argparse import ArgumentError
|
|
||||||
from contextvars import ContextVar
|
|
||||||
from collections.abc import Sequence
|
|
||||||
from itertools import chain, product
|
|
||||||
from argparse import Namespace as Namespace
|
|
||||||
from argparse import ArgumentParser as ArgParser
|
|
||||||
from typing import (
|
from typing import (
|
||||||
IO,
|
IO,
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Union,
|
NamedTuple,
|
||||||
TypeVar,
|
|
||||||
Optional,
|
Optional,
|
||||||
TypedDict,
|
TypedDict,
|
||||||
NamedTuple,
|
TypeVar,
|
||||||
|
Union,
|
||||||
cast,
|
cast,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
@@ -36,27 +35,27 @@ from typing import (
|
|||||||
from pygtrie import CharTrie
|
from pygtrie import CharTrie
|
||||||
|
|
||||||
from nonebot import get_driver
|
from nonebot import get_driver
|
||||||
from nonebot.log import logger
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
from nonebot.exception import ParserExit
|
|
||||||
from nonebot.internal.rule import Rule as Rule
|
|
||||||
from nonebot.adapters import Bot, Event, Message, MessageSegment
|
from nonebot.adapters import Bot, Event, Message, MessageSegment
|
||||||
from nonebot.params import Command, EventToMe, CommandArg, CommandWhitespace
|
|
||||||
from nonebot.consts import (
|
from nonebot.consts import (
|
||||||
|
CMD_ARG_KEY,
|
||||||
CMD_KEY,
|
CMD_KEY,
|
||||||
|
CMD_START_KEY,
|
||||||
|
CMD_WHITESPACE_KEY,
|
||||||
|
ENDSWITH_KEY,
|
||||||
|
FULLMATCH_KEY,
|
||||||
|
KEYWORD_KEY,
|
||||||
PREFIX_KEY,
|
PREFIX_KEY,
|
||||||
|
RAW_CMD_KEY,
|
||||||
|
REGEX_MATCHED,
|
||||||
SHELL_ARGS,
|
SHELL_ARGS,
|
||||||
SHELL_ARGV,
|
SHELL_ARGV,
|
||||||
CMD_ARG_KEY,
|
|
||||||
KEYWORD_KEY,
|
|
||||||
RAW_CMD_KEY,
|
|
||||||
ENDSWITH_KEY,
|
|
||||||
CMD_START_KEY,
|
|
||||||
FULLMATCH_KEY,
|
|
||||||
REGEX_MATCHED,
|
|
||||||
STARTSWITH_KEY,
|
STARTSWITH_KEY,
|
||||||
CMD_WHITESPACE_KEY,
|
|
||||||
)
|
)
|
||||||
|
from nonebot.exception import ParserExit
|
||||||
|
from nonebot.internal.rule import Rule as Rule
|
||||||
|
from nonebot.log import logger
|
||||||
|
from nonebot.params import Command, CommandArg, CommandWhitespace, EventToMe
|
||||||
|
from nonebot.typing import T_State
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
@@ -146,7 +145,7 @@ class StartswithRule:
|
|||||||
ignorecase: 是否忽略大小写
|
ignorecase: 是否忽略大小写
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ("msg", "ignorecase")
|
__slots__ = ("ignorecase", "msg")
|
||||||
|
|
||||||
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
@@ -201,7 +200,7 @@ class EndswithRule:
|
|||||||
ignorecase: 是否忽略大小写
|
ignorecase: 是否忽略大小写
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ("msg", "ignorecase")
|
__slots__ = ("ignorecase", "msg")
|
||||||
|
|
||||||
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
@@ -256,7 +255,7 @@ class FullmatchRule:
|
|||||||
ignorecase: 是否忽略大小写
|
ignorecase: 是否忽略大小写
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ("msg", "ignorecase")
|
__slots__ = ("ignorecase", "msg")
|
||||||
|
|
||||||
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
def __init__(self, msg: tuple[str, ...], ignorecase: bool = False):
|
||||||
self.msg = tuple(map(str.casefold, msg) if ignorecase else msg)
|
self.msg = tuple(map(str.casefold, msg) if ignorecase else msg)
|
||||||
@@ -655,7 +654,7 @@ class RegexRule:
|
|||||||
flags: 正则表达式标记
|
flags: 正则表达式标记
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ("regex", "flags")
|
__slots__ = ("flags", "regex")
|
||||||
|
|
||||||
def __init__(self, regex: str, flags: int = 0):
|
def __init__(self, regex: str, flags: int = 0):
|
||||||
self.regex = regex
|
self.regex = regex
|
||||||
|
@@ -14,16 +14,16 @@ FrontMatter:
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import warnings
|
|
||||||
import typing as t
|
import typing as t
|
||||||
import typing_extensions as t_ext
|
|
||||||
from typing import TYPE_CHECKING, TypeVar
|
from typing import TYPE_CHECKING, TypeVar
|
||||||
from typing_extensions import ParamSpec, TypeAlias, get_args, override, get_origin
|
import typing_extensions as t_ext
|
||||||
|
from typing_extensions import ParamSpec, TypeAlias, get_args, get_origin, override
|
||||||
|
import warnings
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from nonebot.adapters import Bot
|
from nonebot.adapters import Bot
|
||||||
from nonebot.permission import Permission
|
|
||||||
from nonebot.internal.params import DependencyCache
|
from nonebot.internal.params import DependencyCache
|
||||||
|
from nonebot.permission import Permission
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
P = ParamSpec("P")
|
P = ParamSpec("P")
|
||||||
|
@@ -7,32 +7,32 @@ FrontMatter:
|
|||||||
description: nonebot.utils 模块
|
description: nonebot.utils 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
|
||||||
import json
|
|
||||||
import inspect
|
|
||||||
import importlib
|
|
||||||
import contextlib
|
|
||||||
import dataclasses
|
|
||||||
from pathlib import Path
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from functools import wraps, partial
|
from collections.abc import AsyncGenerator, Coroutine, Generator, Mapping, Sequence
|
||||||
|
import contextlib
|
||||||
from contextlib import AbstractContextManager, asynccontextmanager
|
from contextlib import AbstractContextManager, asynccontextmanager
|
||||||
from typing_extensions import ParamSpec, get_args, override, get_origin
|
import dataclasses
|
||||||
from typing import Any, Union, Generic, TypeVar, Callable, Optional, overload
|
from functools import partial, wraps
|
||||||
from collections.abc import Mapping, Sequence, Coroutine, Generator, AsyncGenerator
|
import importlib
|
||||||
|
import inspect
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
from typing import Any, Callable, Generic, Optional, TypeVar, Union, overload
|
||||||
|
from typing_extensions import ParamSpec, get_args, get_origin, override
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import anyio.to_thread
|
import anyio.to_thread
|
||||||
from pydantic import BaseModel
|
|
||||||
from exceptiongroup import BaseExceptionGroup, catch
|
from exceptiongroup import BaseExceptionGroup, catch
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
from nonebot.typing import (
|
from nonebot.typing import (
|
||||||
is_none_type,
|
|
||||||
type_has_args,
|
|
||||||
origin_is_union,
|
|
||||||
origin_is_literal,
|
|
||||||
all_literal_values,
|
all_literal_values,
|
||||||
|
is_none_type,
|
||||||
|
origin_is_literal,
|
||||||
|
origin_is_union,
|
||||||
|
type_has_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
P = ParamSpec("P")
|
P = ParamSpec("P")
|
||||||
|
1901
poetry.lock
generated
1901
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "nonebot2"
|
name = "nonebot2"
|
||||||
version = "2.4.0"
|
version = "2.4.1"
|
||||||
description = "An asynchronous python bot framework."
|
description = "An asynchronous python bot framework."
|
||||||
authors = ["yanyongyu <yyy@nonebot.dev>"]
|
authors = ["yanyongyu <yyy@nonebot.dev>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -33,24 +33,22 @@ exceptiongroup = "^1.2.2"
|
|||||||
loguru = ">=0.6.0,<1.0.0"
|
loguru = ">=0.6.0,<1.0.0"
|
||||||
python-dotenv = ">=0.21.0,<2.0.0"
|
python-dotenv = ">=0.21.0,<2.0.0"
|
||||||
typing-extensions = ">=4.4.0,<5.0.0"
|
typing-extensions = ">=4.4.0,<5.0.0"
|
||||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1"
|
|
||||||
tomli = { version = "^2.0.1", python = "<3.11" }
|
tomli = { version = "^2.0.1", python = "<3.11" }
|
||||||
|
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0,!=2.10.1"
|
||||||
|
|
||||||
websockets = { version = ">=10.0", optional = true }
|
websockets = { version = ">=10.0", optional = true }
|
||||||
Quart = { version = ">=0.18.0,<1.0.0", optional = true }
|
Quart = { version = ">=0.18.0,<1.0.0", optional = true }
|
||||||
fastapi = { version = ">=0.93.0,<1.0.0", optional = true }
|
fastapi = { version = ">=0.93.0,<1.0.0", optional = true }
|
||||||
aiohttp = { version = "^3.9.0b0", extras = ["speedups"], optional = true }
|
aiohttp = { version = "^3.11.0", extras = ["speedups"], optional = true }
|
||||||
httpx = { version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true }
|
httpx = { version = ">=0.26.0,<1.0.0", extras = ["http2"], optional = true }
|
||||||
uvicorn = { version = ">=0.20.0,<1.0.0", extras = [
|
uvicorn = { version = ">=0.20.0,<1.0.0", extras = [
|
||||||
"standard",
|
"standard",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
ruff = "^0.7.0"
|
ruff = "^0.8.0"
|
||||||
isort = "^5.10.1"
|
|
||||||
black = "^24.0.0"
|
|
||||||
nonemoji = "^0.1.2"
|
nonemoji = "^0.1.2"
|
||||||
pre-commit = "^3.0.0"
|
pre-commit = "^4.0.0"
|
||||||
|
|
||||||
[tool.poetry.group.test.dependencies]
|
[tool.poetry.group.test.dependencies]
|
||||||
nonebot-test = { path = "./envs/test/", develop = false }
|
nonebot-test = { path = "./envs/test/", develop = false }
|
||||||
@@ -70,31 +68,19 @@ all = ["fastapi", "quart", "aiohttp", "httpx", "websockets", "uvicorn"]
|
|||||||
addopts = "--cov=nonebot --cov-report=term-missing"
|
addopts = "--cov=nonebot --cov-report=term-missing"
|
||||||
filterwarnings = ["error", "ignore::DeprecationWarning"]
|
filterwarnings = ["error", "ignore::DeprecationWarning"]
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
line-length = 88
|
|
||||||
target-version = ["py39", "py310", "py311", "py312"]
|
|
||||||
include = '\.pyi?$'
|
|
||||||
extend-exclude = '''
|
|
||||||
'''
|
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
profile = "black"
|
|
||||||
line_length = 88
|
|
||||||
length_sort = true
|
|
||||||
skip_gitignore = true
|
|
||||||
force_sort_within_sections = true
|
|
||||||
src_paths = ["nonebot", "tests"]
|
|
||||||
extra_standard_library = ["typing_extensions"]
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
line-ending = "lf"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = [
|
select = [
|
||||||
"F", # Pyflakes
|
"F", # Pyflakes
|
||||||
"W", # pycodestyle warnings
|
"W", # pycodestyle warnings
|
||||||
"E", # pycodestyle errors
|
"E", # pycodestyle errors
|
||||||
|
"I", # isort
|
||||||
"UP", # pyupgrade
|
"UP", # pyupgrade
|
||||||
"ASYNC", # flake8-async
|
"ASYNC", # flake8-async
|
||||||
"C4", # flake8-comprehensions
|
"C4", # flake8-comprehensions
|
||||||
@@ -103,6 +89,7 @@ select = [
|
|||||||
"PYI", # flake8-pyi
|
"PYI", # flake8-pyi
|
||||||
"PT", # flake8-pytest-style
|
"PT", # flake8-pytest-style
|
||||||
"Q", # flake8-quotes
|
"Q", # flake8-quotes
|
||||||
|
"TID", # flake8-tidy-imports
|
||||||
"RUF", # Ruff-specific rules
|
"RUF", # Ruff-specific rules
|
||||||
]
|
]
|
||||||
ignore = [
|
ignore = [
|
||||||
@@ -113,10 +100,19 @@ ignore = [
|
|||||||
"RUF003", # ambiguous-unicode-character-comment
|
"RUF003", # ambiguous-unicode-character-comment
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
force-sort-within-sections = true
|
||||||
|
known-first-party = ["nonebot", "tests/*"]
|
||||||
|
extra-standard-library = ["typing_extensions"]
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-pytest-style]
|
[tool.ruff.lint.flake8-pytest-style]
|
||||||
fixture-parentheses = false
|
fixture-parentheses = false
|
||||||
mark-parentheses = false
|
mark-parentheses = false
|
||||||
|
|
||||||
|
[tool.ruff.lint.pyupgrade]
|
||||||
|
keep-runtime-typing = true
|
||||||
|
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
pythonVersion = "3.9"
|
pythonVersion = "3.9"
|
||||||
pythonPlatform = "All"
|
pythonPlatform = "All"
|
||||||
|
@@ -4,4 +4,4 @@
|
|||||||
cd "$(dirname "$0")/../tests"
|
cd "$(dirname "$0")/../tests"
|
||||||
|
|
||||||
# Run the tests
|
# Run the tests
|
||||||
pytest -n auto --cov-append --cov-report xml $@
|
pytest -n auto --cov-append --cov-report xml --junitxml=./junit.xml $@
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
import os
|
|
||||||
import threading
|
|
||||||
from pathlib import Path
|
|
||||||
from functools import wraps
|
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
|
from functools import wraps
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import threading
|
||||||
|
from typing import TYPE_CHECKING, Callable, TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
from typing import TYPE_CHECKING, TypeVar, Callable
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import NONEBOT_INIT_KWARGS
|
from nonebug import NONEBOT_INIT_KWARGS
|
||||||
|
import pytest
|
||||||
from werkzeug.serving import BaseWSGIServer, make_server
|
from werkzeug.serving import BaseWSGIServer, make_server
|
||||||
|
|
||||||
import nonebot
|
|
||||||
from nonebot.config import Env
|
|
||||||
from fake_server import request_handler
|
from fake_server import request_handler
|
||||||
from nonebot.drivers import URL, Driver
|
import nonebot
|
||||||
from nonebot import _resolve_combine_expr
|
from nonebot import _resolve_combine_expr
|
||||||
|
from nonebot.config import Env
|
||||||
|
from nonebot.drivers import URL, Driver
|
||||||
|
|
||||||
os.environ["CONFIG_FROM_ENV"] = '{"test": "test"}'
|
os.environ["CONFIG_FROM_ENV"] = '{"test": "test"}'
|
||||||
os.environ["CONFIG_OVERRIDE"] = "new"
|
os.environ["CONFIG_OVERRIDE"] = "new"
|
||||||
|
@@ -1,15 +1,20 @@
|
|||||||
import json
|
|
||||||
import base64
|
import base64
|
||||||
|
import json
|
||||||
import socket
|
import socket
|
||||||
from typing import Union, TypeVar
|
from typing import TypeVar, Union
|
||||||
|
|
||||||
from wsproto.events import Ping
|
|
||||||
from werkzeug import Request, Response
|
from werkzeug import Request, Response
|
||||||
from werkzeug.datastructures import MultiDict
|
from werkzeug.datastructures import MultiDict
|
||||||
from wsproto.frame_protocol import CloseReason
|
from wsproto import ConnectionType, WSConnection
|
||||||
|
from wsproto.events import (
|
||||||
|
AcceptConnection,
|
||||||
|
BytesMessage,
|
||||||
|
CloseConnection,
|
||||||
|
Ping,
|
||||||
|
TextMessage,
|
||||||
|
)
|
||||||
from wsproto.events import Request as WSRequest
|
from wsproto.events import Request as WSRequest
|
||||||
from wsproto import WSConnection, ConnectionType
|
from wsproto.frame_protocol import CloseReason
|
||||||
from wsproto.events import TextMessage, BytesMessage, CloseConnection, AcceptConnection
|
|
||||||
|
|
||||||
K = TypeVar("K")
|
K = TypeVar("K")
|
||||||
V = TypeVar("V")
|
V = TypeVar("V")
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from nonebot import on_message
|
from nonebot import on_message
|
||||||
from nonebot.matcher import Matcher
|
|
||||||
from nonebot.adapters import Event, Message
|
from nonebot.adapters import Event, Message
|
||||||
from nonebot.params import ArgStr, Received, EventMessage, LastReceived
|
from nonebot.matcher import Matcher
|
||||||
|
from nonebot.params import ArgStr, EventMessage, LastReceived, Received
|
||||||
|
|
||||||
test_handle = on_message()
|
test_handle = on_message()
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from typing import Annotated
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from nonebot.adapters import Message
|
from nonebot.adapters import Message
|
||||||
from nonebot.params import Arg, ArgStr, ArgPlainText
|
from nonebot.params import Arg, ArgPlainText, ArgPromptResult, ArgStr
|
||||||
|
|
||||||
|
|
||||||
async def arg(key: Message = Arg()) -> Message:
|
async def arg(key: Message = Arg()) -> Message:
|
||||||
@@ -28,12 +28,16 @@ async def annotated_arg_plain_text(key: Annotated[str, ArgPlainText()]) -> str:
|
|||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
|
async def annotated_arg_prompt_result(key: Annotated[Any, ArgPromptResult()]) -> Any:
|
||||||
|
return key
|
||||||
|
|
||||||
|
|
||||||
# test dependency priority
|
# test dependency priority
|
||||||
async def annotated_prior_arg(key: Annotated[str, ArgStr("foo")] = ArgPlainText()):
|
async def annotated_prior_arg(key: Annotated[str, ArgStr("foo")] = ArgPlainText()):
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
async def annotated_multi_arg(
|
async def annotated_multi_arg(
|
||||||
key: Annotated[Annotated[str, ArgStr("foo")], ArgPlainText()]
|
key: Annotated[Annotated[str, ArgStr("foo")], ArgPlainText()],
|
||||||
):
|
):
|
||||||
return key
|
return key
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from typing import Union, TypeVar
|
from typing import TypeVar, Union
|
||||||
|
|
||||||
from nonebot.adapters import Bot
|
from nonebot.adapters import Bot
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from typing import Annotated
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
@@ -74,13 +74,13 @@ async def annotated_class_depend(c: Annotated[ClassDependency, Depends()]):
|
|||||||
|
|
||||||
# test dependency priority
|
# test dependency priority
|
||||||
async def annotated_prior_depend(
|
async def annotated_prior_depend(
|
||||||
x: Annotated[int, Depends(lambda: 2)] = Depends(dependency)
|
x: Annotated[int, Depends(lambda: 2)] = Depends(dependency),
|
||||||
):
|
):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
async def annotated_multi_depend(
|
async def annotated_multi_depend(
|
||||||
x: Annotated[Annotated[int, Depends(lambda: 2)], Depends(dependency)]
|
x: Annotated[Annotated[int, Depends(lambda: 2)], Depends(dependency)],
|
||||||
):
|
):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from typing import Union, TypeVar
|
from typing import TypeVar, Union
|
||||||
|
|
||||||
from nonebot.adapters import Event, Message
|
from nonebot.adapters import Event, Message
|
||||||
from nonebot.params import EventToMe, EventType, EventMessage, EventPlainText
|
from nonebot.params import EventMessage, EventPlainText, EventToMe, EventType
|
||||||
|
|
||||||
|
|
||||||
async def event(e: Event) -> Event:
|
async def event(e: Event) -> Event:
|
||||||
|
@@ -1,8 +1,13 @@
|
|||||||
from typing import Union, TypeVar
|
from typing import Any, TypeVar, Union
|
||||||
|
|
||||||
from nonebot.adapters import Event
|
from nonebot.adapters import Event
|
||||||
from nonebot.matcher import Matcher
|
from nonebot.matcher import Matcher
|
||||||
from nonebot.params import Received, LastReceived
|
from nonebot.params import (
|
||||||
|
LastReceived,
|
||||||
|
PausePromptResult,
|
||||||
|
Received,
|
||||||
|
ReceivePromptResult,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def matcher(m: Matcher) -> Matcher:
|
async def matcher(m: Matcher) -> Matcher:
|
||||||
@@ -59,3 +64,11 @@ async def receive(e: Event = Received("test")) -> Event:
|
|||||||
|
|
||||||
async def last_receive(e: Event = LastReceived()) -> Event:
|
async def last_receive(e: Event = LastReceived()) -> Event:
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
|
async def receive_prompt_result(result: Any = ReceivePromptResult("test")) -> Any:
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
async def pause_prompt_result(result: Any = PausePromptResult()) -> Any:
|
||||||
|
return result
|
||||||
|
@@ -1,24 +1,24 @@
|
|||||||
from re import Match
|
from re import Match
|
||||||
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
from nonebot.adapters import Message
|
from nonebot.adapters import Message
|
||||||
from nonebot.params import (
|
from nonebot.params import (
|
||||||
Command,
|
Command,
|
||||||
Keyword,
|
|
||||||
Endswith,
|
|
||||||
RegexStr,
|
|
||||||
Fullmatch,
|
|
||||||
RegexDict,
|
|
||||||
CommandArg,
|
CommandArg,
|
||||||
RawCommand,
|
|
||||||
RegexGroup,
|
|
||||||
Startswith,
|
|
||||||
CommandStart,
|
CommandStart,
|
||||||
|
CommandWhitespace,
|
||||||
|
Endswith,
|
||||||
|
Fullmatch,
|
||||||
|
Keyword,
|
||||||
|
RawCommand,
|
||||||
|
RegexDict,
|
||||||
|
RegexGroup,
|
||||||
RegexMatched,
|
RegexMatched,
|
||||||
|
RegexStr,
|
||||||
ShellCommandArgs,
|
ShellCommandArgs,
|
||||||
ShellCommandArgv,
|
ShellCommandArgv,
|
||||||
CommandWhitespace,
|
Startswith,
|
||||||
)
|
)
|
||||||
|
from nonebot.typing import T_State
|
||||||
|
|
||||||
|
|
||||||
async def state(x: T_State) -> T_State:
|
async def state(x: T_State) -> T_State:
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from nonebot.typing import T_State
|
from nonebot.adapters import Bot, Event, Message
|
||||||
from nonebot.matcher import Matcher
|
from nonebot.matcher import Matcher
|
||||||
from nonebot.params import Arg, Depends
|
from nonebot.params import Arg, Depends
|
||||||
from nonebot.adapters import Bot, Event, Message
|
from nonebot.typing import T_State
|
||||||
|
|
||||||
|
|
||||||
def dependency():
|
def dependency():
|
||||||
|
@@ -1,24 +1,24 @@
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from nonebot.adapters import Event
|
|
||||||
from nonebot.matcher import Matcher
|
|
||||||
from nonebot import (
|
from nonebot import (
|
||||||
CommandGroup,
|
CommandGroup,
|
||||||
MatcherGroup,
|
MatcherGroup,
|
||||||
on,
|
on,
|
||||||
on_type,
|
|
||||||
on_regex,
|
|
||||||
on_notice,
|
|
||||||
on_command,
|
on_command,
|
||||||
on_keyword,
|
|
||||||
on_message,
|
|
||||||
on_request,
|
|
||||||
on_endswith,
|
on_endswith,
|
||||||
on_fullmatch,
|
on_fullmatch,
|
||||||
|
on_keyword,
|
||||||
|
on_message,
|
||||||
on_metaevent,
|
on_metaevent,
|
||||||
on_startswith,
|
on_notice,
|
||||||
|
on_regex,
|
||||||
|
on_request,
|
||||||
on_shell_command,
|
on_shell_command,
|
||||||
|
on_startswith,
|
||||||
|
on_type,
|
||||||
)
|
)
|
||||||
|
from nonebot.adapters import Event
|
||||||
|
from nonebot.matcher import Matcher
|
||||||
|
|
||||||
|
|
||||||
async def rule() -> bool:
|
async def rule() -> bool:
|
||||||
|
5
tests/pyproject.toml
Normal file
5
tests/pyproject.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[tool.ruff]
|
||||||
|
extend = "../pyproject.toml"
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
known-first-party = ["nonebot", "fake_server", "utils"]
|
@@ -1,20 +1,20 @@
|
|||||||
from typing import Optional
|
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from utils import FakeAdapter
|
|
||||||
from nonebot.adapters import Bot
|
from nonebot.adapters import Bot
|
||||||
from nonebot.drivers import (
|
from nonebot.drivers import (
|
||||||
URL,
|
URL,
|
||||||
Driver,
|
Driver,
|
||||||
|
HTTPServerSetup,
|
||||||
Request,
|
Request,
|
||||||
Response,
|
Response,
|
||||||
WebSocket,
|
WebSocket,
|
||||||
HTTPServerSetup,
|
|
||||||
WebSocketServerSetup,
|
WebSocketServerSetup,
|
||||||
)
|
)
|
||||||
|
from utils import FakeAdapter
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot.adapters import Bot
|
from nonebot.adapters import Bot
|
||||||
from nonebot.exception import MockApiException
|
from nonebot.exception import MockApiException
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import pytest
|
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from nonebot.adapters import Message, MessageSegment
|
||||||
from nonebot.compat import type_validate_python
|
from nonebot.compat import type_validate_python
|
||||||
from utils import FakeMessage, FakeMessageSegment
|
from utils import FakeMessage, FakeMessageSegment
|
||||||
from nonebot.adapters import Message, MessageSegment
|
|
||||||
|
|
||||||
|
|
||||||
def test_segment_data():
|
def test_segment_data():
|
||||||
|
@@ -1,24 +1,24 @@
|
|||||||
import sys
|
import sys
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot import on_message
|
from nonebot import on_message
|
||||||
import nonebot.message as message
|
|
||||||
from utils import make_fake_event
|
|
||||||
from nonebot.params import Depends
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
from nonebot.matcher import Matcher
|
|
||||||
from nonebot.adapters import Bot, Event
|
from nonebot.adapters import Bot, Event
|
||||||
from nonebot.exception import IgnoredException
|
from nonebot.exception import IgnoredException
|
||||||
from nonebot.log import logger, default_filter, default_format
|
from nonebot.log import default_filter, default_format, logger
|
||||||
|
from nonebot.matcher import Matcher
|
||||||
|
import nonebot.message as message
|
||||||
from nonebot.message import (
|
from nonebot.message import (
|
||||||
run_preprocessor,
|
|
||||||
run_postprocessor,
|
|
||||||
event_preprocessor,
|
|
||||||
event_postprocessor,
|
event_postprocessor,
|
||||||
|
event_preprocessor,
|
||||||
|
run_postprocessor,
|
||||||
|
run_preprocessor,
|
||||||
)
|
)
|
||||||
|
from nonebot.params import Depends
|
||||||
|
from nonebot.typing import T_State
|
||||||
|
from utils import make_fake_event
|
||||||
|
|
||||||
|
|
||||||
async def _dependency() -> int:
|
async def _dependency() -> int:
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Optional, Annotated
|
from typing import Annotated, Any, Optional
|
||||||
|
|
||||||
import pytest
|
|
||||||
from pydantic import BaseModel, ValidationError
|
from pydantic import BaseModel, ValidationError
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot.compat import (
|
from nonebot.compat import (
|
||||||
DEFAULT_CONFIG,
|
DEFAULT_CONFIG,
|
||||||
Required,
|
|
||||||
FieldInfo,
|
FieldInfo,
|
||||||
TypeAdapter,
|
|
||||||
PydanticUndefined,
|
PydanticUndefined,
|
||||||
model_dump,
|
Required,
|
||||||
|
TypeAdapter,
|
||||||
custom_validation,
|
custom_validation,
|
||||||
|
model_dump,
|
||||||
type_validate_json,
|
type_validate_json,
|
||||||
type_validate_python,
|
type_validate_python,
|
||||||
)
|
)
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
from typing import TYPE_CHECKING, Union, Optional
|
from typing import TYPE_CHECKING, Optional, Union
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
import pytest
|
import pytest
|
||||||
from pydantic import Field, BaseModel
|
|
||||||
|
|
||||||
from nonebot.compat import PYDANTIC_V2
|
from nonebot.compat import PYDANTIC_V2
|
||||||
from nonebot.config import DOTENV_TYPE, BaseSettings, SettingsError, SettingsConfig
|
from nonebot.config import DOTENV_TYPE, BaseSettings, SettingsConfig, SettingsError
|
||||||
|
|
||||||
|
|
||||||
class Simple(BaseModel):
|
class Simple(BaseModel):
|
||||||
|
@@ -1,28 +1,28 @@
|
|||||||
|
from http.cookies import SimpleCookie
|
||||||
import json
|
import json
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from http.cookies import SimpleCookie
|
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from utils import FakeAdapter
|
|
||||||
from nonebot.adapters import Bot
|
from nonebot.adapters import Bot
|
||||||
from nonebot.params import Depends
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import WebSocketClosed
|
|
||||||
from nonebot.drivers import (
|
from nonebot.drivers import (
|
||||||
URL,
|
URL,
|
||||||
Driver,
|
|
||||||
Request,
|
|
||||||
Response,
|
|
||||||
ASGIMixin,
|
ASGIMixin,
|
||||||
WebSocket,
|
Driver,
|
||||||
HTTPClientMixin,
|
HTTPClientMixin,
|
||||||
HTTPServerSetup,
|
HTTPServerSetup,
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
|
WebSocket,
|
||||||
WebSocketClientMixin,
|
WebSocketClientMixin,
|
||||||
WebSocketServerSetup,
|
WebSocketServerSetup,
|
||||||
)
|
)
|
||||||
|
from nonebot.exception import WebSocketClosed
|
||||||
|
from nonebot.params import Depends
|
||||||
|
from utils import FakeAdapter
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from utils import FakeMessage, FakeMessageSegment, make_fake_event
|
from utils import FakeMessage, FakeMessageSegment, make_fake_event
|
||||||
|
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
import nonebot
|
import nonebot
|
||||||
from nonebot.drivers import Driver, ASGIMixin, ReverseDriver
|
|
||||||
from nonebot import (
|
from nonebot import (
|
||||||
get_app,
|
|
||||||
get_bot,
|
|
||||||
get_asgi,
|
|
||||||
get_bots,
|
|
||||||
get_driver,
|
|
||||||
get_adapter,
|
get_adapter,
|
||||||
get_adapters,
|
get_adapters,
|
||||||
|
get_app,
|
||||||
|
get_asgi,
|
||||||
|
get_bot,
|
||||||
|
get_bots,
|
||||||
|
get_driver,
|
||||||
)
|
)
|
||||||
|
from nonebot.drivers import ASGIMixin, Driver, ReverseDriver
|
||||||
|
|
||||||
|
|
||||||
def test_init():
|
def test_init():
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import sys
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot.rule import Rule
|
|
||||||
from nonebot import get_plugin
|
from nonebot import get_plugin
|
||||||
from nonebot.matcher import Matcher, matchers
|
from nonebot.matcher import Matcher, matchers
|
||||||
from utils import FakeMessage, make_fake_event
|
|
||||||
from nonebot.permission import User, Permission
|
|
||||||
from nonebot.message import _check_matcher, check_and_run_matcher
|
from nonebot.message import _check_matcher, check_and_run_matcher
|
||||||
|
from nonebot.permission import Permission, User
|
||||||
|
from nonebot.rule import Rule
|
||||||
|
from utils import FakeMessage, make_fake_event
|
||||||
|
|
||||||
|
|
||||||
def test_matcher_info(app: App):
|
def test_matcher_info(app: App):
|
||||||
@@ -211,7 +211,7 @@ async def test_matcher_destroy(app: App):
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_type_updater(app: App):
|
async def test_type_updater(app: App):
|
||||||
from plugins.matcher.matcher_type import test_type_updater, test_custom_updater
|
from plugins.matcher.matcher_type import test_custom_updater, test_type_updater
|
||||||
|
|
||||||
event = make_fake_event()()
|
event = make_fake_event()()
|
||||||
|
|
||||||
@@ -276,8 +276,8 @@ async def test_user_permission_updater(app: App):
|
|||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_custom_permission_updater(app: App):
|
async def test_custom_permission_updater(app: App):
|
||||||
from plugins.matcher.matcher_permission import (
|
from plugins.matcher.matcher_permission import (
|
||||||
new_permission,
|
|
||||||
default_permission,
|
default_permission,
|
||||||
|
new_permission,
|
||||||
test_custom_updater,
|
test_custom_updater,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1,38 +1,41 @@
|
|||||||
|
from contextlib import suppress
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import BaseExceptionGroup
|
||||||
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot.matcher import Matcher
|
from nonebot.consts import (
|
||||||
|
ARG_KEY,
|
||||||
|
CMD_ARG_KEY,
|
||||||
|
CMD_KEY,
|
||||||
|
CMD_START_KEY,
|
||||||
|
CMD_WHITESPACE_KEY,
|
||||||
|
ENDSWITH_KEY,
|
||||||
|
FULLMATCH_KEY,
|
||||||
|
KEYWORD_KEY,
|
||||||
|
PREFIX_KEY,
|
||||||
|
RAW_CMD_KEY,
|
||||||
|
RECEIVE_KEY,
|
||||||
|
REGEX_MATCHED,
|
||||||
|
SHELL_ARGS,
|
||||||
|
SHELL_ARGV,
|
||||||
|
STARTSWITH_KEY,
|
||||||
|
)
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import TypeMisMatch
|
from nonebot.exception import PausedException, RejectedException, TypeMisMatch
|
||||||
from utils import FakeMessage, make_fake_event
|
from nonebot.matcher import Matcher
|
||||||
from nonebot.params import (
|
from nonebot.params import (
|
||||||
ArgParam,
|
ArgParam,
|
||||||
BotParam,
|
BotParam,
|
||||||
EventParam,
|
|
||||||
StateParam,
|
|
||||||
DependParam,
|
|
||||||
DefaultParam,
|
DefaultParam,
|
||||||
MatcherParam,
|
DependParam,
|
||||||
|
EventParam,
|
||||||
ExceptionParam,
|
ExceptionParam,
|
||||||
|
MatcherParam,
|
||||||
|
StateParam,
|
||||||
)
|
)
|
||||||
from nonebot.consts import (
|
from utils import FakeMessage, make_fake_event
|
||||||
CMD_KEY,
|
|
||||||
PREFIX_KEY,
|
|
||||||
SHELL_ARGS,
|
|
||||||
SHELL_ARGV,
|
|
||||||
CMD_ARG_KEY,
|
|
||||||
KEYWORD_KEY,
|
|
||||||
RAW_CMD_KEY,
|
|
||||||
ENDSWITH_KEY,
|
|
||||||
CMD_START_KEY,
|
|
||||||
FULLMATCH_KEY,
|
|
||||||
REGEX_MATCHED,
|
|
||||||
STARTSWITH_KEY,
|
|
||||||
CMD_WHITESPACE_KEY,
|
|
||||||
)
|
|
||||||
|
|
||||||
UNKNOWN_PARAM = "Unknown parameter"
|
UNKNOWN_PARAM = "Unknown parameter"
|
||||||
|
|
||||||
@@ -41,21 +44,21 @@ UNKNOWN_PARAM = "Unknown parameter"
|
|||||||
async def test_depend(app: App):
|
async def test_depend(app: App):
|
||||||
from plugins.param.param_depend import (
|
from plugins.param.param_depend import (
|
||||||
ClassDependency,
|
ClassDependency,
|
||||||
runned,
|
|
||||||
depends,
|
|
||||||
validate,
|
|
||||||
class_depend,
|
|
||||||
test_depends,
|
|
||||||
validate_fail,
|
|
||||||
validate_field,
|
|
||||||
annotated_depend,
|
|
||||||
sub_type_mismatch,
|
|
||||||
validate_field_fail,
|
|
||||||
cache_exception_func1,
|
|
||||||
cache_exception_func2,
|
|
||||||
annotated_class_depend,
|
annotated_class_depend,
|
||||||
|
annotated_depend,
|
||||||
annotated_multi_depend,
|
annotated_multi_depend,
|
||||||
annotated_prior_depend,
|
annotated_prior_depend,
|
||||||
|
cache_exception_func1,
|
||||||
|
cache_exception_func2,
|
||||||
|
class_depend,
|
||||||
|
depends,
|
||||||
|
runned,
|
||||||
|
sub_type_mismatch,
|
||||||
|
test_depends,
|
||||||
|
validate,
|
||||||
|
validate_fail,
|
||||||
|
validate_field,
|
||||||
|
validate_field_fail,
|
||||||
)
|
)
|
||||||
|
|
||||||
async with app.test_dependent(depends, allow_types=[DependParam]) as ctx:
|
async with app.test_dependent(depends, allow_types=[DependParam]) as ctx:
|
||||||
@@ -157,15 +160,15 @@ async def test_depend(app: App):
|
|||||||
async def test_bot(app: App):
|
async def test_bot(app: App):
|
||||||
from plugins.param.param_bot import (
|
from plugins.param.param_bot import (
|
||||||
FooBot,
|
FooBot,
|
||||||
|
generic_bot,
|
||||||
|
generic_bot_none,
|
||||||
get_bot,
|
get_bot,
|
||||||
|
legacy_bot,
|
||||||
not_bot,
|
not_bot,
|
||||||
|
not_legacy_bot,
|
||||||
|
postpone_bot,
|
||||||
sub_bot,
|
sub_bot,
|
||||||
union_bot,
|
union_bot,
|
||||||
legacy_bot,
|
|
||||||
generic_bot,
|
|
||||||
postpone_bot,
|
|
||||||
not_legacy_bot,
|
|
||||||
generic_bot_none,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async with app.test_dependent(get_bot, allow_types=[BotParam]) as ctx:
|
async with app.test_dependent(get_bot, allow_types=[BotParam]) as ctx:
|
||||||
@@ -223,18 +226,18 @@ async def test_event(app: App):
|
|||||||
from plugins.param.param_event import (
|
from plugins.param.param_event import (
|
||||||
FooEvent,
|
FooEvent,
|
||||||
event,
|
event,
|
||||||
not_event,
|
|
||||||
sub_event,
|
|
||||||
event_type,
|
|
||||||
event_to_me,
|
|
||||||
union_event,
|
|
||||||
legacy_event,
|
|
||||||
event_message,
|
event_message,
|
||||||
generic_event,
|
|
||||||
postpone_event,
|
|
||||||
event_plain_text,
|
event_plain_text,
|
||||||
not_legacy_event,
|
event_to_me,
|
||||||
|
event_type,
|
||||||
|
generic_event,
|
||||||
generic_event_none,
|
generic_event_none,
|
||||||
|
legacy_event,
|
||||||
|
not_event,
|
||||||
|
not_legacy_event,
|
||||||
|
postpone_event,
|
||||||
|
sub_event,
|
||||||
|
union_event,
|
||||||
)
|
)
|
||||||
|
|
||||||
fake_message = FakeMessage("text")
|
fake_message = FakeMessage("text")
|
||||||
@@ -310,25 +313,25 @@ async def test_event(app: App):
|
|||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_state(app: App):
|
async def test_state(app: App):
|
||||||
from plugins.param.param_state import (
|
from plugins.param.param_state import (
|
||||||
state,
|
|
||||||
command,
|
command,
|
||||||
keyword,
|
command_arg,
|
||||||
|
command_start,
|
||||||
|
command_whitespace,
|
||||||
endswith,
|
endswith,
|
||||||
fullmatch,
|
fullmatch,
|
||||||
regex_str,
|
keyword,
|
||||||
regex_dict,
|
|
||||||
startswith,
|
|
||||||
command_arg,
|
|
||||||
raw_command,
|
|
||||||
regex_group,
|
|
||||||
legacy_state,
|
legacy_state,
|
||||||
command_start,
|
|
||||||
regex_matched,
|
|
||||||
postpone_state,
|
|
||||||
not_legacy_state,
|
not_legacy_state,
|
||||||
command_whitespace,
|
postpone_state,
|
||||||
|
raw_command,
|
||||||
|
regex_dict,
|
||||||
|
regex_group,
|
||||||
|
regex_matched,
|
||||||
|
regex_str,
|
||||||
shell_command_args,
|
shell_command_args,
|
||||||
shell_command_argv,
|
shell_command_argv,
|
||||||
|
startswith,
|
||||||
|
state,
|
||||||
)
|
)
|
||||||
|
|
||||||
fake_message = FakeMessage("text")
|
fake_message = FakeMessage("text")
|
||||||
@@ -462,17 +465,19 @@ async def test_state(app: App):
|
|||||||
async def test_matcher(app: App):
|
async def test_matcher(app: App):
|
||||||
from plugins.param.param_matcher import (
|
from plugins.param.param_matcher import (
|
||||||
FooMatcher,
|
FooMatcher,
|
||||||
matcher,
|
|
||||||
receive,
|
|
||||||
not_matcher,
|
|
||||||
sub_matcher,
|
|
||||||
last_receive,
|
|
||||||
union_matcher,
|
|
||||||
legacy_matcher,
|
|
||||||
generic_matcher,
|
generic_matcher,
|
||||||
postpone_matcher,
|
|
||||||
not_legacy_matcher,
|
|
||||||
generic_matcher_none,
|
generic_matcher_none,
|
||||||
|
last_receive,
|
||||||
|
legacy_matcher,
|
||||||
|
matcher,
|
||||||
|
not_legacy_matcher,
|
||||||
|
not_matcher,
|
||||||
|
pause_prompt_result,
|
||||||
|
postpone_matcher,
|
||||||
|
receive,
|
||||||
|
receive_prompt_result,
|
||||||
|
sub_matcher,
|
||||||
|
union_matcher,
|
||||||
)
|
)
|
||||||
|
|
||||||
fake_matcher = Matcher()
|
fake_matcher = Matcher()
|
||||||
@@ -538,21 +543,52 @@ async def test_matcher(app: App):
|
|||||||
ctx.pass_params(matcher=fake_matcher)
|
ctx.pass_params(matcher=fake_matcher)
|
||||||
ctx.should_return(event_next)
|
ctx.should_return(event_next)
|
||||||
|
|
||||||
|
fake_matcher.set_target(RECEIVE_KEY.format(id="test"), cache=False)
|
||||||
|
|
||||||
|
async with app.test_api() as ctx:
|
||||||
|
bot = ctx.create_bot()
|
||||||
|
ctx.should_call_send(event, "test", result=True, bot=bot)
|
||||||
|
with fake_matcher.ensure_context(bot, event):
|
||||||
|
with suppress(RejectedException):
|
||||||
|
await fake_matcher.reject("test")
|
||||||
|
|
||||||
|
async with app.test_dependent(
|
||||||
|
receive_prompt_result, allow_types=[MatcherParam, DependParam]
|
||||||
|
) as ctx:
|
||||||
|
ctx.pass_params(matcher=fake_matcher)
|
||||||
|
ctx.should_return(True)
|
||||||
|
|
||||||
|
async with app.test_api() as ctx:
|
||||||
|
bot = ctx.create_bot()
|
||||||
|
ctx.should_call_send(event, "test", result=False, bot=bot)
|
||||||
|
with fake_matcher.ensure_context(bot, event):
|
||||||
|
fake_matcher.set_target("test")
|
||||||
|
with suppress(PausedException):
|
||||||
|
await fake_matcher.pause("test")
|
||||||
|
|
||||||
|
async with app.test_dependent(
|
||||||
|
pause_prompt_result, allow_types=[MatcherParam, DependParam]
|
||||||
|
) as ctx:
|
||||||
|
ctx.pass_params(matcher=fake_matcher)
|
||||||
|
ctx.should_return(False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_arg(app: App):
|
async def test_arg(app: App):
|
||||||
from plugins.param.param_arg import (
|
from plugins.param.param_arg import (
|
||||||
arg,
|
|
||||||
arg_str,
|
|
||||||
annotated_arg,
|
annotated_arg,
|
||||||
arg_plain_text,
|
annotated_arg_plain_text,
|
||||||
|
annotated_arg_prompt_result,
|
||||||
annotated_arg_str,
|
annotated_arg_str,
|
||||||
annotated_multi_arg,
|
annotated_multi_arg,
|
||||||
annotated_prior_arg,
|
annotated_prior_arg,
|
||||||
annotated_arg_plain_text,
|
arg,
|
||||||
|
arg_plain_text,
|
||||||
|
arg_str,
|
||||||
)
|
)
|
||||||
|
|
||||||
matcher = Matcher()
|
matcher = Matcher()
|
||||||
|
event = make_fake_event()()
|
||||||
message = FakeMessage("text")
|
message = FakeMessage("text")
|
||||||
matcher.set_arg("key", message)
|
matcher.set_arg("key", message)
|
||||||
|
|
||||||
@@ -582,6 +618,21 @@ async def test_arg(app: App):
|
|||||||
ctx.pass_params(matcher=matcher)
|
ctx.pass_params(matcher=matcher)
|
||||||
ctx.should_return(message.extract_plain_text())
|
ctx.should_return(message.extract_plain_text())
|
||||||
|
|
||||||
|
matcher.set_target(ARG_KEY.format(key="key"), cache=False)
|
||||||
|
|
||||||
|
async with app.test_api() as ctx:
|
||||||
|
bot = ctx.create_bot()
|
||||||
|
ctx.should_call_send(event, "test", result="arg", bot=bot)
|
||||||
|
with matcher.ensure_context(bot, event):
|
||||||
|
with suppress(RejectedException):
|
||||||
|
await matcher.reject("test")
|
||||||
|
|
||||||
|
async with app.test_dependent(
|
||||||
|
annotated_arg_prompt_result, allow_types=[ArgParam]
|
||||||
|
) as ctx:
|
||||||
|
ctx.pass_params(matcher=matcher)
|
||||||
|
ctx.should_return("arg")
|
||||||
|
|
||||||
async with app.test_dependent(annotated_multi_arg, allow_types=[ArgParam]) as ctx:
|
async with app.test_dependent(annotated_multi_arg, allow_types=[ArgParam]) as ctx:
|
||||||
ctx.pass_params(matcher=matcher)
|
ctx.pass_params(matcher=matcher)
|
||||||
ctx.should_return(message.extract_plain_text())
|
ctx.should_return(message.extract_plain_text())
|
||||||
|
@@ -1,25 +1,25 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from utils import make_fake_event
|
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.permission import (
|
from nonebot.permission import (
|
||||||
USER,
|
|
||||||
NOTICE,
|
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
REQUEST,
|
|
||||||
METAEVENT,
|
METAEVENT,
|
||||||
|
NOTICE,
|
||||||
|
REQUEST,
|
||||||
SUPERUSER,
|
SUPERUSER,
|
||||||
User,
|
USER,
|
||||||
Notice,
|
|
||||||
Message,
|
Message,
|
||||||
Request,
|
|
||||||
MetaEvent,
|
MetaEvent,
|
||||||
SuperUser,
|
Notice,
|
||||||
Permission,
|
Permission,
|
||||||
|
Request,
|
||||||
|
SuperUser,
|
||||||
|
User,
|
||||||
)
|
)
|
||||||
|
from utils import make_fake_event
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from functools import wraps
|
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from typing import TypeVar, Callable
|
from functools import wraps
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
from typing import Callable, TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -11,8 +11,8 @@ import nonebot
|
|||||||
from nonebot.plugin import (
|
from nonebot.plugin import (
|
||||||
Plugin,
|
Plugin,
|
||||||
PluginManager,
|
PluginManager,
|
||||||
_plugins,
|
|
||||||
_managers,
|
_managers,
|
||||||
|
_plugins,
|
||||||
inherit_supported_adapters,
|
inherit_supported_adapters,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,7 +21,6 @@ R = TypeVar("R")
|
|||||||
|
|
||||||
|
|
||||||
def _recover(func: Callable[P, R]) -> Callable[P, R]:
|
def _recover(func: Callable[P, R]) -> Callable[P, R]:
|
||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
||||||
origin_managers = _managers.copy()
|
origin_managers = _managers.copy()
|
||||||
|
@@ -4,18 +4,18 @@ import pytest
|
|||||||
|
|
||||||
import nonebot
|
import nonebot
|
||||||
from nonebot.adapters import Event
|
from nonebot.adapters import Event
|
||||||
from nonebot.typing import T_RuleChecker
|
|
||||||
from nonebot.matcher import Matcher, matchers
|
from nonebot.matcher import Matcher, matchers
|
||||||
from nonebot.rule import (
|
from nonebot.rule import (
|
||||||
RegexRule,
|
|
||||||
IsTypeRule,
|
|
||||||
CommandRule,
|
CommandRule,
|
||||||
EndswithRule,
|
EndswithRule,
|
||||||
KeywordsRule,
|
|
||||||
FullmatchRule,
|
FullmatchRule,
|
||||||
StartswithRule,
|
IsTypeRule,
|
||||||
|
KeywordsRule,
|
||||||
|
RegexRule,
|
||||||
ShellCommandRule,
|
ShellCommandRule,
|
||||||
|
StartswithRule,
|
||||||
)
|
)
|
||||||
|
from nonebot.typing import T_RuleChecker
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -109,12 +109,12 @@ def test_on(
|
|||||||
import plugins.plugin.matchers as module
|
import plugins.plugin.matchers as module
|
||||||
from plugins.plugin.matchers import (
|
from plugins.plugin.matchers import (
|
||||||
TestEvent,
|
TestEvent,
|
||||||
|
expire_time,
|
||||||
|
handler,
|
||||||
|
permission,
|
||||||
|
priority,
|
||||||
rule,
|
rule,
|
||||||
state,
|
state,
|
||||||
handler,
|
|
||||||
priority,
|
|
||||||
permission,
|
|
||||||
expire_time,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
matcher = getattr(module, matcher_name)
|
matcher = getattr(module, matcher_name)
|
||||||
|
@@ -1,52 +1,52 @@
|
|||||||
import re
|
import re
|
||||||
from re import Match
|
from re import Match
|
||||||
from typing import Union, Optional
|
from typing import Optional, Union
|
||||||
|
|
||||||
import pytest
|
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
import pytest
|
||||||
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
from nonebot.exception import ParserExit, SkippedException
|
|
||||||
from utils import FakeMessage, FakeMessageSegment, make_fake_event
|
|
||||||
from nonebot.consts import (
|
from nonebot.consts import (
|
||||||
CMD_KEY,
|
|
||||||
PREFIX_KEY,
|
|
||||||
SHELL_ARGS,
|
|
||||||
SHELL_ARGV,
|
|
||||||
CMD_ARG_KEY,
|
CMD_ARG_KEY,
|
||||||
KEYWORD_KEY,
|
CMD_KEY,
|
||||||
|
CMD_WHITESPACE_KEY,
|
||||||
ENDSWITH_KEY,
|
ENDSWITH_KEY,
|
||||||
FULLMATCH_KEY,
|
FULLMATCH_KEY,
|
||||||
|
KEYWORD_KEY,
|
||||||
|
PREFIX_KEY,
|
||||||
REGEX_MATCHED,
|
REGEX_MATCHED,
|
||||||
|
SHELL_ARGS,
|
||||||
|
SHELL_ARGV,
|
||||||
STARTSWITH_KEY,
|
STARTSWITH_KEY,
|
||||||
CMD_WHITESPACE_KEY,
|
|
||||||
)
|
)
|
||||||
|
from nonebot.exception import ParserExit, SkippedException
|
||||||
from nonebot.rule import (
|
from nonebot.rule import (
|
||||||
CMD_RESULT,
|
CMD_RESULT,
|
||||||
TRIE_VALUE,
|
TRIE_VALUE,
|
||||||
Rule,
|
ArgumentParser,
|
||||||
ToMeRule,
|
|
||||||
TrieRule,
|
|
||||||
Namespace,
|
|
||||||
RegexRule,
|
|
||||||
IsTypeRule,
|
|
||||||
CommandRule,
|
CommandRule,
|
||||||
EndswithRule,
|
EndswithRule,
|
||||||
KeywordsRule,
|
|
||||||
FullmatchRule,
|
FullmatchRule,
|
||||||
ArgumentParser,
|
IsTypeRule,
|
||||||
StartswithRule,
|
KeywordsRule,
|
||||||
|
Namespace,
|
||||||
|
RegexRule,
|
||||||
|
Rule,
|
||||||
ShellCommandRule,
|
ShellCommandRule,
|
||||||
regex,
|
StartswithRule,
|
||||||
to_me,
|
ToMeRule,
|
||||||
|
TrieRule,
|
||||||
command,
|
command,
|
||||||
is_type,
|
|
||||||
keyword,
|
|
||||||
endswith,
|
endswith,
|
||||||
fullmatch,
|
fullmatch,
|
||||||
startswith,
|
is_type,
|
||||||
|
keyword,
|
||||||
|
regex,
|
||||||
shell_command,
|
shell_command,
|
||||||
|
startswith,
|
||||||
|
to_me,
|
||||||
)
|
)
|
||||||
|
from nonebot.typing import T_State
|
||||||
|
from utils import FakeMessage, FakeMessageSegment, make_fake_event
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@@ -7,7 +7,7 @@ from utils import make_fake_event
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_matcher_mutex():
|
async def test_matcher_mutex():
|
||||||
from nonebot.plugins.single_session import matcher_mutex, _running_matcher
|
from nonebot.plugins.single_session import _running_matcher, matcher_mutex
|
||||||
|
|
||||||
am = asynccontextmanager(matcher_mutex)
|
am = asynccontextmanager(matcher_mutex)
|
||||||
event = make_fake_event()()
|
event = make_fake_event()()
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import json
|
import json
|
||||||
from typing import Dict, List, Union, Literal, TypeVar, ClassVar # noqa: UP035
|
from typing import ClassVar, Dict, List, Literal, TypeVar, Union # noqa: UP035
|
||||||
|
|
||||||
from utils import FakeMessage, FakeMessageSegment
|
|
||||||
from nonebot.utils import (
|
from nonebot.utils import (
|
||||||
DataclassEncoder,
|
DataclassEncoder,
|
||||||
escape_tag,
|
escape_tag,
|
||||||
is_gen_callable,
|
generic_check_issubclass,
|
||||||
is_async_gen_callable,
|
is_async_gen_callable,
|
||||||
is_coroutine_callable,
|
is_coroutine_callable,
|
||||||
generic_check_issubclass,
|
is_gen_callable,
|
||||||
)
|
)
|
||||||
|
from utils import FakeMessage, FakeMessageSegment
|
||||||
|
|
||||||
|
|
||||||
def test_loguru_escape_tag():
|
def test_loguru_escape_tag():
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
from typing import Union, Optional
|
from collections.abc import Iterable, Mapping
|
||||||
|
from typing import Optional, Union
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
from collections.abc import Mapping, Iterable
|
|
||||||
|
|
||||||
from pydantic import Extra, create_model
|
from pydantic import create_model
|
||||||
|
|
||||||
from nonebot.adapters import Bot, Event, Adapter, Message, MessageSegment
|
from nonebot.adapters import Adapter, Bot, Event, Message, MessageSegment
|
||||||
|
|
||||||
|
|
||||||
def escape_text(s: str, *, escape_comma: bool = True) -> str:
|
def escape_text(s: str, *, escape_comma: bool = True) -> str:
|
||||||
@@ -89,7 +89,7 @@ def make_fake_event(
|
|||||||
) -> type[Event]:
|
) -> type[Event]:
|
||||||
Base = _base or Event
|
Base = _base or Event
|
||||||
|
|
||||||
class FakeEvent(Base, extra=Extra.forbid):
|
class FakeEvent(Base):
|
||||||
@override
|
@override
|
||||||
def get_type(self) -> str:
|
def get_type(self) -> str:
|
||||||
return _type
|
return _type
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
|
|
||||||
};
|
|
@@ -1224,6 +1224,37 @@ async def _(foo: Event = LastReceived()): ...
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
### ReceivePromptResult
|
||||||
|
|
||||||
|
获取某次 `receive` 发送提示消息的结果。
|
||||||
|
|
||||||
|
<Tabs groupId="annotated">
|
||||||
|
<TabItem value="annotated" label="Use Annotated" default>
|
||||||
|
|
||||||
|
```python {6}
|
||||||
|
from typing import Any, Annotated
|
||||||
|
|
||||||
|
from nonebot.params import ReceivePromptResult
|
||||||
|
|
||||||
|
@matcher.receive("id", prompt="prompt")
|
||||||
|
async def _(result: Annotated[Any, ReceivePromptResult("id")]): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="no-annotated" label="Without Annotated">
|
||||||
|
|
||||||
|
```python {6}
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from nonebot.params import ReceivePromptResult
|
||||||
|
|
||||||
|
@matcher.receive("id", prompt="prompt")
|
||||||
|
async def _(result: Any = ReceivePromptResult("id")): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
### Arg
|
### Arg
|
||||||
|
|
||||||
获取某次 `got` 接收的参数。如果 `Arg` 参数留空,则使用函数的参数名作为要获取的参数。
|
获取某次 `got` 接收的参数。如果 `Arg` 参数留空,则使用函数的参数名作为要获取的参数。
|
||||||
@@ -1318,3 +1349,75 @@ async def _(foo: str = ArgPlainText("key")): ...
|
|||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
### ArgPromptResult
|
||||||
|
|
||||||
|
获取某次 `got` 发送提示消息的结果。如果 `Arg` 参数留空,则使用函数的参数名作为要获取的参数。
|
||||||
|
|
||||||
|
<Tabs groupId="annotated">
|
||||||
|
<TabItem value="annotated" label="Use Annotated" default>
|
||||||
|
|
||||||
|
```python {6,7}
|
||||||
|
from typing import Any, Annotated
|
||||||
|
|
||||||
|
from nonebot.params import ArgPromptResult
|
||||||
|
|
||||||
|
@matcher.got("key", prompt="prompt")
|
||||||
|
async def _(result: Annotated[Any, ArgPromptResult()]): ...
|
||||||
|
async def _(result: Annotated[Any, ArgPromptResult("key")]): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="no-annotated" label="Without Annotated">
|
||||||
|
|
||||||
|
```python {6,7}
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from nonebot.params import ArgPromptResult
|
||||||
|
|
||||||
|
@matcher.got("key", prompt="prompt")
|
||||||
|
async def _(result: Any = ArgPromptResult()): ...
|
||||||
|
async def _(result: Any = ArgPromptResult("key")): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
|
### PausePromptResult
|
||||||
|
|
||||||
|
获取最近一次 `pause` 发送提示消息的结果。
|
||||||
|
|
||||||
|
<Tabs groupId="annotated">
|
||||||
|
<TabItem value="annotated" label="Use Annotated" default>
|
||||||
|
|
||||||
|
```python {6}
|
||||||
|
from typing import Any, Annotated
|
||||||
|
|
||||||
|
from nonebot.params import PausePromptResult
|
||||||
|
|
||||||
|
@matcher.handle()
|
||||||
|
async def _():
|
||||||
|
await matcher.pause(prompt="prompt")
|
||||||
|
|
||||||
|
@matcher.handle()
|
||||||
|
async def _(result: Annotated[Any, PausePromptResult()]): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="no-annotated" label="Without Annotated">
|
||||||
|
|
||||||
|
```python {6}
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from nonebot.params import PausePromptResult
|
||||||
|
|
||||||
|
@matcher.handle()
|
||||||
|
async def _():
|
||||||
|
await matcher.pause(prompt="prompt")
|
||||||
|
|
||||||
|
@matcher.handle()
|
||||||
|
async def _(result: Any = PausePromptResult()): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user