mirror of
https://github.com/nonebot/nonebot2.git
synced 2026-01-14 07:41:54 +00:00
Compare commits
82 Commits
v2.3.2
...
publish/is
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8c36e8eff | ||
|
|
1cc5d1af33 | ||
|
|
88074cf5c3 | ||
|
|
5d637eed95 | ||
|
|
362c43ce5f | ||
|
|
622b8eb51e | ||
|
|
c369dcf781 | ||
|
|
53d1e1dee9 | ||
|
|
75f5825cff | ||
|
|
d05c90787c | ||
|
|
e07ba36a4a | ||
|
|
f7c05d9a08 | ||
|
|
59c5a1a35d | ||
|
|
3eb653821e | ||
|
|
214bc838c2 | ||
|
|
79c7ea5bab | ||
|
|
b59b1be6ff | ||
|
|
aeb75a6ce3 | ||
|
|
847325a119 | ||
|
|
26eabfaf6f | ||
|
|
40a7b97220 | ||
|
|
91b40748c4 | ||
|
|
013a2f94d6 | ||
|
|
74d280ed75 | ||
|
|
b7d46de10e | ||
|
|
c37b5bbbca | ||
|
|
5e08e73698 | ||
|
|
b27bb92d03 | ||
|
|
6bf8858cc6 | ||
|
|
c97a780645 | ||
|
|
976c1cd8e0 | ||
|
|
26fd6f8a6c | ||
|
|
0020ad28ba | ||
|
|
ba9ca63f10 | ||
|
|
28b5b732c2 | ||
|
|
b944da8445 | ||
|
|
5cab166d6b | ||
|
|
546cdb4229 | ||
|
|
77790fad1f | ||
|
|
bcf849c98f | ||
|
|
f7b3c8af02 | ||
|
|
cced60589c | ||
|
|
62adb32c94 | ||
|
|
6ab752dcdb | ||
|
|
4d6f071739 | ||
|
|
bd140c2ceb | ||
|
|
59d9991aa4 | ||
|
|
55e7f59e40 | ||
|
|
bb83483020 | ||
|
|
5300ef5119 | ||
|
|
5a50d4203c | ||
|
|
01a96f3086 | ||
|
|
0570d779ee | ||
|
|
18d0bc2c81 | ||
|
|
87e0d8148f | ||
|
|
53d8989145 | ||
|
|
5433b4ebdf | ||
|
|
f10cecf16a | ||
|
|
60a3f6f4cc | ||
|
|
f70ae89098 | ||
|
|
2f60c5e9b4 | ||
|
|
015ddd9517 | ||
|
|
f1539d9ec4 | ||
|
|
2d0444ba75 | ||
|
|
ed2c222e83 | ||
|
|
ed048913a4 | ||
|
|
121ba17698 | ||
|
|
d0f5a76c47 | ||
|
|
f809f1d089 | ||
|
|
070ad18781 | ||
|
|
56119ef1cc | ||
|
|
30195a35dc | ||
|
|
0500b7baab | ||
|
|
08473a5c25 | ||
|
|
37ad14c277 | ||
|
|
3e8c6ce541 | ||
|
|
3dd5539dc7 | ||
|
|
559a0320a8 | ||
|
|
8646d885f0 | ||
|
|
84c008cdce | ||
|
|
2671cb5b72 | ||
|
|
379440708f |
99
.github/workflows/website-preview-cd.yml
vendored
Normal file
99
.github/workflows/website-preview-cd.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Site Deploy (Preview CD)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Site Deploy (Preview CI)"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
preview-cd:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
concurrency:
|
||||||
|
group: pull-request-preview-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
|
||||||
|
environment: pull request
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
statuses: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set Commit Status
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
github.rest.repos.createCommitStatus({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
sha: context.payload.workflow_run.head_sha,
|
||||||
|
context: 'Website Preview',
|
||||||
|
description: 'Deploying...',
|
||||||
|
state: 'pending',
|
||||||
|
})
|
||||||
|
|
||||||
|
- name: Download Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: website-preview
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
|
- name: Restore Context
|
||||||
|
run: |
|
||||||
|
cat action.env >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set Deploy Name
|
||||||
|
run: |
|
||||||
|
echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Deploy to Netlify
|
||||||
|
id: deploy
|
||||||
|
uses: nwtgck/actions-netlify@v3
|
||||||
|
with:
|
||||||
|
publish-dir: ./website/build
|
||||||
|
production-deploy: false
|
||||||
|
deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.event.workflow_run.head_sha }}"
|
||||||
|
alias: ${{ env.DEPLOY_NAME }}
|
||||||
|
env:
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
|
||||||
|
|
||||||
|
# action netlify has no pull request context, so we need to comment by ourselves
|
||||||
|
- name: Comment on Pull Request
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
header: website
|
||||||
|
number: ${{ env.PR_NUMBER }}
|
||||||
|
message: |
|
||||||
|
:rocket: Deployed to ${{ steps.deploy.outputs.deploy-url }}
|
||||||
|
|
||||||
|
- name: Set Commit Status
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
if (`${{ job.status }}` === 'success') {
|
||||||
|
github.rest.repos.createCommitStatus({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
sha: context.payload.workflow_run.head_sha,
|
||||||
|
context: 'Website Preview',
|
||||||
|
description: `Deployed to ${{ steps.deploy.outputs.deploy-url }}`,
|
||||||
|
state: 'success',
|
||||||
|
target_url: `${{ steps.deploy.outputs.deploy-url }}`,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
github.rest.repos.createCommitStatus({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
sha: context.payload.workflow_run.head_sha,
|
||||||
|
context: 'Website Preview',
|
||||||
|
description: `Deploy ${{ job.status }}`,
|
||||||
|
state: 'failure',
|
||||||
|
})
|
||||||
|
}
|
||||||
42
.github/workflows/website-preview-ci.yml
vendored
Normal file
42
.github/workflows/website-preview-ci.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Site Deploy (Preview CI)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
preview-ci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
concurrency:
|
||||||
|
group: pull-request-preview-${{ github.event.number }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Python Environment
|
||||||
|
uses: ./.github/actions/setup-python
|
||||||
|
|
||||||
|
- name: Setup Node Environment
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
|
||||||
|
- name: Build API Doc
|
||||||
|
uses: ./.github/actions/build-api-doc
|
||||||
|
|
||||||
|
- name: Build Doc
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Export Context
|
||||||
|
run: |
|
||||||
|
echo "PR_NUMBER=${{ github.event.number }}" >> ./action.env
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: website-preview
|
||||||
|
path: |
|
||||||
|
./website/build
|
||||||
|
./action.env
|
||||||
|
retention-days: 1
|
||||||
46
.github/workflows/website-preview.yml
vendored
46
.github/workflows/website-preview.yml
vendored
@@ -1,46 +0,0 @@
|
|||||||
name: Site Deploy(Preview)
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
preview:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
concurrency:
|
|
||||||
group: pull-request-preview-${{ github.event.number }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Python Environment
|
|
||||||
uses: ./.github/actions/setup-python
|
|
||||||
|
|
||||||
- name: Setup Node Environment
|
|
||||||
uses: ./.github/actions/setup-node
|
|
||||||
|
|
||||||
- name: Build API Doc
|
|
||||||
uses: ./.github/actions/build-api-doc
|
|
||||||
|
|
||||||
- name: Build Doc
|
|
||||||
run: yarn build
|
|
||||||
|
|
||||||
- name: Get Deploy Name
|
|
||||||
run: |
|
|
||||||
echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
|
||||||
uses: nwtgck/actions-netlify@v3
|
|
||||||
with:
|
|
||||||
publish-dir: "./website/build"
|
|
||||||
production-deploy: false
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}"
|
|
||||||
enable-commit-comment: false
|
|
||||||
alias: ${{ env.DEPLOY_NAME }}
|
|
||||||
env:
|
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
||||||
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
|
|
||||||
@@ -7,7 +7,7 @@ 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.5.0
|
rev: v0.5.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
@@ -20,7 +20,7 @@ repos:
|
|||||||
stages: [commit]
|
stages: [commit]
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 24.4.2
|
rev: 24.8.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
stages: [commit]
|
stages: [commit]
|
||||||
|
|||||||
@@ -607,5 +607,30 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"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",
|
||||||
|
"desc": "基于 NoneBot2 的 Minecraft 群服互联 QQ 机器人,支持多服务器多种方式连接。",
|
||||||
|
"author": "Lonely-Sails",
|
||||||
|
"homepage": "https://github.com/Minecraft-QQBot/BotServer",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "Minecraft",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "娱乐",
|
||||||
|
"color": "#37a7e7"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -855,15 +855,33 @@
|
|||||||
{
|
{
|
||||||
"module_name": "nonebot_plugin_charpic",
|
"module_name": "nonebot_plugin_charpic",
|
||||||
"project_link": "nonebot-plugin-charpic",
|
"project_link": "nonebot-plugin-charpic",
|
||||||
"author": "RafuiiChan",
|
"author": "1umine",
|
||||||
"tags": [],
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "字符画",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "多平台适配",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module_name": "nonebot_plugin_miragetank",
|
"module_name": "nonebot_plugin_miragetank",
|
||||||
"project_link": "nonebot-plugin-miragetank",
|
"project_link": "nonebot-plugin-miragetank",
|
||||||
"author": "RafuiiChan",
|
"author": "1umine",
|
||||||
"tags": [],
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "幻影坦克",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "多平台适配",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -4554,18 +4572,6 @@
|
|||||||
],
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"module_name": "nonebot_plugin_kanonbot",
|
|
||||||
"project_link": "nonebot-plugin-kanonbot",
|
|
||||||
"author": "SuperGuGuGu",
|
|
||||||
"tags": [
|
|
||||||
{
|
|
||||||
"label": "KanonBot",
|
|
||||||
"color": "#44ddff"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"is_official": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"module_name": "nonebot_plugin_mcversion",
|
"module_name": "nonebot_plugin_mcversion",
|
||||||
"project_link": "nonebot-plugin-mcversion",
|
"project_link": "nonebot-plugin-mcversion",
|
||||||
@@ -5563,7 +5569,7 @@
|
|||||||
{
|
{
|
||||||
"module_name": "nonebot_plugin_fishing",
|
"module_name": "nonebot_plugin_fishing",
|
||||||
"project_link": "nonebot-plugin-fishing",
|
"project_link": "nonebot-plugin-fishing",
|
||||||
"author": "C14H22O",
|
"author": "ALittleBot",
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"label": "钓鱼",
|
"label": "钓鱼",
|
||||||
@@ -6022,6 +6028,14 @@
|
|||||||
{
|
{
|
||||||
"label": "AI",
|
"label": "AI",
|
||||||
"color": "#00ff00"
|
"color": "#00ff00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "星火",
|
||||||
|
"color": "#0000ff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Chat",
|
||||||
|
"color": "#ff0000"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
@@ -6418,5 +6432,285 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_official": false
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_anymate",
|
||||||
|
"project_link": "nonebot-plugin-anymate",
|
||||||
|
"author": "QuickLAW",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "server",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "func",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_cfr2",
|
||||||
|
"project_link": "nonebot-plugin-cfr2",
|
||||||
|
"author": "1v7w",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_WWwiki",
|
||||||
|
"project_link": "nonebot-plugin-WWwiki",
|
||||||
|
"author": "shi-yingyingjiang",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "鸣潮",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "wiki",
|
||||||
|
"color": "#30af29"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_acgnshow",
|
||||||
|
"project_link": "nonebot-plugin-acgnshow",
|
||||||
|
"author": "Asankilp",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "bilibili",
|
||||||
|
"color": "#f21010"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_runagain",
|
||||||
|
"project_link": "nonebot-plugin-runagain",
|
||||||
|
"author": "NCBM",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_wordle_simple",
|
||||||
|
"project_link": "nonebot-plugin-wordle-simple",
|
||||||
|
"author": "shiyihang2007",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_daily_oil_price",
|
||||||
|
"project_link": "nonebot-plugin-daily-oil-price",
|
||||||
|
"author": "wyeeeee",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_game_torrent",
|
||||||
|
"project_link": "nonebot-plugin-game-torrent",
|
||||||
|
"author": "Cvandia",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_weiweibot",
|
||||||
|
"project_link": "nonebot-plugin-weiweibot",
|
||||||
|
"author": "SwedishDoveCooker",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_autopush",
|
||||||
|
"project_link": "nonebot-plugin-autopush",
|
||||||
|
"author": "This-is-XiaoDeng",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_exe_code",
|
||||||
|
"project_link": "nonebot-plugin-exe-code",
|
||||||
|
"author": "wyf7685",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_system_command",
|
||||||
|
"project_link": "nonebot-plugin-system-command",
|
||||||
|
"author": "tkgs0",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "shell",
|
||||||
|
"color": "#0078d4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "cmd",
|
||||||
|
"color": "#24292f"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_cogvideox",
|
||||||
|
"project_link": "nonebot-plugin-cogvideox",
|
||||||
|
"author": "Alpaca4610",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "AI",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "视频生成",
|
||||||
|
"color": "#1a30b7"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_gpt_sovits",
|
||||||
|
"project_link": "nonebot-plugin-gpt-sovits",
|
||||||
|
"author": "zhaomaoniu",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "GPT-SoVITS",
|
||||||
|
"color": "#000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_wakatime",
|
||||||
|
"project_link": "nonebot-plugin-wakatime",
|
||||||
|
"author": "KomoriDev",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "WakaTime",
|
||||||
|
"color": "#000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_sunoai",
|
||||||
|
"project_link": "nonebot-plugin-sunoai",
|
||||||
|
"author": "CCYellowStar2",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "SunoAi",
|
||||||
|
"color": "#ea5252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "AI歌曲",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_function",
|
||||||
|
"project_link": "nonebot-plugin-function",
|
||||||
|
"author": "zhongwen-4",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_web_bottle",
|
||||||
|
"project_link": "nonebot-plugin-web-bottle",
|
||||||
|
"author": "luosheng520qaq",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "漂流瓶",
|
||||||
|
"color": "#689dd0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "审核",
|
||||||
|
"color": "#e3567b"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_deer_pipe",
|
||||||
|
"project_link": "nonebot-plugin-deer-pipe",
|
||||||
|
"author": "SamuNatsu",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_alist",
|
||||||
|
"project_link": "nonebot-plugin-alist",
|
||||||
|
"author": "iam57ao",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_bili_fav_watcher",
|
||||||
|
"project_link": "nonebot-plugin-bili-fav-watcher",
|
||||||
|
"author": "kawaiior",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "bilibili",
|
||||||
|
"color": "#ea5252"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_essence_message",
|
||||||
|
"project_link": "nonebot-plugin-essence-message",
|
||||||
|
"author": "BEISNWKZNAN",
|
||||||
|
"tags": [],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_ba_tools",
|
||||||
|
"project_link": "nonebot-plugin-ba-tools",
|
||||||
|
"author": "hanasa2023",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "蔚蓝档案",
|
||||||
|
"color": "#00fcf8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_fakepic",
|
||||||
|
"project_link": "nonebot-plugin-fakepic",
|
||||||
|
"author": "lm175",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "图片生成",
|
||||||
|
"color": "#3a82ff"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "pokepoke_miss",
|
||||||
|
"project_link": "pokepoke-miss",
|
||||||
|
"author": "shengwang52005",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "舞萌",
|
||||||
|
"color": "#f7fe0e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "戳一戳",
|
||||||
|
"color": "#e80606"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_ehentai_search",
|
||||||
|
"project_link": "nonebot-plugin-ehentai-search",
|
||||||
|
"author": "N791",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "ehentai",
|
||||||
|
"color": "#ffe700"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,17 +8,20 @@ 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 typing_extensions import Self, get_args, get_origin, is_typeddict
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
Union,
|
Union,
|
||||||
|
Generic,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Callable,
|
Callable,
|
||||||
Optional,
|
Optional,
|
||||||
Protocol,
|
Protocol,
|
||||||
Annotated,
|
Annotated,
|
||||||
|
overload,
|
||||||
)
|
)
|
||||||
|
|
||||||
from pydantic import VERSION, BaseModel
|
from pydantic import VERSION, BaseModel
|
||||||
@@ -46,8 +49,8 @@ __all__ = (
|
|||||||
"DEFAULT_CONFIG",
|
"DEFAULT_CONFIG",
|
||||||
"FieldInfo",
|
"FieldInfo",
|
||||||
"ModelField",
|
"ModelField",
|
||||||
|
"TypeAdapter",
|
||||||
"extract_field_info",
|
"extract_field_info",
|
||||||
"model_field_validate",
|
|
||||||
"model_fields",
|
"model_fields",
|
||||||
"model_config",
|
"model_config",
|
||||||
"model_dump",
|
"model_dump",
|
||||||
@@ -63,9 +66,10 @@ __autodoc__ = {
|
|||||||
|
|
||||||
|
|
||||||
if PYDANTIC_V2: # pragma: pydantic-v2
|
if PYDANTIC_V2: # pragma: pydantic-v2
|
||||||
|
from pydantic import GetCoreSchemaHandler
|
||||||
|
from pydantic import TypeAdapter as TypeAdapter
|
||||||
from pydantic_core import CoreSchema, core_schema
|
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 import TypeAdapter, GetCoreSchemaHandler
|
|
||||||
from pydantic.fields import FieldInfo as BaseFieldInfo
|
from pydantic.fields import FieldInfo as BaseFieldInfo
|
||||||
|
|
||||||
Required = Ellipsis
|
Required = Ellipsis
|
||||||
@@ -125,6 +129,25 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
|||||||
"""Construct a ModelField from given infos."""
|
"""Construct a ModelField from given infos."""
|
||||||
return cls._construct(name, annotation, field_info or FieldInfo())
|
return cls._construct(name, annotation, field_info or FieldInfo())
|
||||||
|
|
||||||
|
def __hash__(self) -> int:
|
||||||
|
# Each ModelField is unique for our purposes,
|
||||||
|
# to allow store them in a set.
|
||||||
|
return id(self)
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def type_adapter(self) -> TypeAdapter:
|
||||||
|
"""TypeAdapter of the field.
|
||||||
|
|
||||||
|
Cache the TypeAdapter to avoid creating it multiple times.
|
||||||
|
Pydantic v2 uses too much cpu time to create TypeAdapter.
|
||||||
|
|
||||||
|
See: https://github.com/pydantic/pydantic/issues/9834
|
||||||
|
"""
|
||||||
|
return TypeAdapter(
|
||||||
|
Annotated[self.annotation, self.field_info],
|
||||||
|
config=None if self._annotation_has_config() else DEFAULT_CONFIG,
|
||||||
|
)
|
||||||
|
|
||||||
def _annotation_has_config(self) -> bool:
|
def _annotation_has_config(self) -> bool:
|
||||||
"""Check if the annotation has config.
|
"""Check if the annotation has config.
|
||||||
|
|
||||||
@@ -152,10 +175,9 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
|||||||
"""Get the display of the type of the field."""
|
"""Get the display of the type of the field."""
|
||||||
return display_as_type(self.annotation)
|
return display_as_type(self.annotation)
|
||||||
|
|
||||||
def __hash__(self) -> int:
|
def validate_value(self, value: Any) -> Any:
|
||||||
# Each ModelField is unique for our purposes,
|
"""Validate the value pass to the field."""
|
||||||
# to allow store them in a set.
|
return self.type_adapter.validate_python(value)
|
||||||
return id(self)
|
|
||||||
|
|
||||||
def extract_field_info(field_info: BaseFieldInfo) -> dict[str, Any]:
|
def extract_field_info(field_info: BaseFieldInfo) -> dict[str, Any]:
|
||||||
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
||||||
@@ -164,15 +186,6 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
|||||||
kwargs["annotation"] = field_info.rebuild_annotation()
|
kwargs["annotation"] = field_info.rebuild_annotation()
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def model_field_validate(
|
|
||||||
model_field: ModelField, value: Any, config: Optional[ConfigDict] = None
|
|
||||||
) -> Any:
|
|
||||||
"""Validate the value pass to the field."""
|
|
||||||
type: Any = Annotated[model_field.annotation, model_field.field_info]
|
|
||||||
return TypeAdapter(
|
|
||||||
type, config=None if model_field._annotation_has_config() else config
|
|
||||||
).validate_python(value)
|
|
||||||
|
|
||||||
def model_fields(model: type[BaseModel]) -> list[ModelField]:
|
def model_fields(model: type[BaseModel]) -> list[ModelField]:
|
||||||
"""Get field list of a model."""
|
"""Get field list of a model."""
|
||||||
|
|
||||||
@@ -305,6 +318,45 @@ else: # pragma: pydantic-v1
|
|||||||
)
|
)
|
||||||
return cls._construct(name, annotation, field_info or FieldInfo())
|
return cls._construct(name, annotation, field_info or FieldInfo())
|
||||||
|
|
||||||
|
def validate_value(self, value: Any) -> Any:
|
||||||
|
"""Validate the value pass to the field."""
|
||||||
|
v, errs_ = self.validate(value, {}, loc=())
|
||||||
|
if errs_:
|
||||||
|
raise ValueError(value, self)
|
||||||
|
return v
|
||||||
|
|
||||||
|
class TypeAdapter(Generic[T]):
|
||||||
|
@overload
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: type[T],
|
||||||
|
*,
|
||||||
|
config: Optional[ConfigDict] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Any,
|
||||||
|
*,
|
||||||
|
config: Optional[ConfigDict] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Any,
|
||||||
|
*,
|
||||||
|
config: Optional[ConfigDict] = None,
|
||||||
|
) -> None:
|
||||||
|
self.type = type
|
||||||
|
self.config = config
|
||||||
|
|
||||||
|
def validate_python(self, value: Any) -> T:
|
||||||
|
return type_validate_python(self.type, value)
|
||||||
|
|
||||||
|
def validate_json(self, value: Union[str, bytes]) -> T:
|
||||||
|
return type_validate_json(self.type, value)
|
||||||
|
|
||||||
def extract_field_info(field_info: BaseFieldInfo) -> dict[str, Any]:
|
def extract_field_info(field_info: BaseFieldInfo) -> dict[str, Any]:
|
||||||
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
||||||
|
|
||||||
@@ -314,22 +366,6 @@ else: # pragma: pydantic-v1
|
|||||||
kwargs.update(field_info.extra)
|
kwargs.update(field_info.extra)
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def model_field_validate(
|
|
||||||
model_field: ModelField, value: Any, config: Optional[type[ConfigDict]] = None
|
|
||||||
) -> Any:
|
|
||||||
"""Validate the value pass to the field.
|
|
||||||
|
|
||||||
Set config before validate to ensure validate correctly.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if model_field.model_config is not config:
|
|
||||||
model_field.set_config(config or ConfigDict)
|
|
||||||
|
|
||||||
v, errs_ = model_field.validate(value, {}, loc=())
|
|
||||||
if errs_:
|
|
||||||
raise ValueError(value, model_field)
|
|
||||||
return v
|
|
||||||
|
|
||||||
def model_fields(model: type[BaseModel]) -> list[ModelField]:
|
def model_fields(model: type[BaseModel]) -> list[ModelField]:
|
||||||
"""Get field list of a model."""
|
"""Get field list of a model."""
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ from typing import Any, Callable, ForwardRef
|
|||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
from nonebot.compat import ModelField
|
||||||
from nonebot.exception import TypeMisMatch
|
from nonebot.exception import TypeMisMatch
|
||||||
from nonebot.typing import evaluate_forwardref
|
from nonebot.typing import evaluate_forwardref
|
||||||
from nonebot.compat import DEFAULT_CONFIG, ModelField, model_field_validate
|
|
||||||
|
|
||||||
|
|
||||||
def get_typed_signature(call: Callable[..., Any]) -> inspect.Signature:
|
def get_typed_signature(call: Callable[..., Any]) -> inspect.Signature:
|
||||||
@@ -51,6 +51,6 @@ def check_field_type(field: ModelField, value: Any) -> Any:
|
|||||||
"""检查字段类型是否匹配"""
|
"""检查字段类型是否匹配"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return model_field_validate(field, value, DEFAULT_CONFIG)
|
return field.validate_value(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise TypeMisMatch(field, value)
|
raise TypeMisMatch(field, value)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def combine_driver(driver: type[D]) -> type[D]: ...
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
def combine_driver(
|
def combine_driver(
|
||||||
driver: type[D], _m: type[Mixin], *mixins: type[Mixin]
|
driver: type[D], __m: type[Mixin], /, *mixins: type[Mixin]
|
||||||
) -> type["CombinedDriver"]: ...
|
) -> type["CombinedDriver"]: ...
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ T = TypeVar("T")
|
|||||||
current_bot: ContextVar[Bot] = ContextVar("current_bot")
|
current_bot: ContextVar[Bot] = ContextVar("current_bot")
|
||||||
current_event: ContextVar[Event] = ContextVar("current_event")
|
current_event: ContextVar[Event] = ContextVar("current_event")
|
||||||
current_matcher: ContextVar["Matcher"] = ContextVar("current_matcher")
|
current_matcher: ContextVar["Matcher"] = ContextVar("current_matcher")
|
||||||
current_handler: ContextVar[Dependent] = ContextVar("current_handler")
|
current_handler: ContextVar[Dependent[Any]] = ContextVar("current_handler")
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class DependParam(Param):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *args, dependent: Dependent, use_cache: bool, **kwargs: Any
|
self, *args, dependent: Dependent[Any], use_cache: bool, **kwargs: Any
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.dependent = dependent
|
self.dependent = dependent
|
||||||
@@ -114,7 +114,7 @@ class DependParam(Param):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _from_field(
|
def _from_field(
|
||||||
cls,
|
cls,
|
||||||
sub_dependent: Dependent,
|
sub_dependent: Dependent[Any],
|
||||||
use_cache: bool,
|
use_cache: bool,
|
||||||
validate: Union[bool, PydanticFieldInfo],
|
validate: Union[bool, PydanticFieldInfo],
|
||||||
) -> Self:
|
) -> Self:
|
||||||
@@ -190,7 +190,7 @@ class DependParam(Param):
|
|||||||
use_cache: bool = self.use_cache
|
use_cache: bool = self.use_cache
|
||||||
dependency_cache = {} if dependency_cache is None else dependency_cache
|
dependency_cache = {} if dependency_cache is None else dependency_cache
|
||||||
|
|
||||||
sub_dependent: Dependent = self.dependent
|
sub_dependent = self.dependent
|
||||||
call = cast(Callable[..., Any], sub_dependent.call)
|
call = cast(Callable[..., Any], sub_dependent.call)
|
||||||
|
|
||||||
# solve sub dependency with current cache
|
# solve sub dependency with current cache
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def on(
|
|||||||
rule: Optional[Union[Rule, T_RuleChecker]] = None,
|
rule: Optional[Union[Rule, T_RuleChecker]] = None,
|
||||||
permission: Optional[Union[Permission, T_PermissionChecker]] = None,
|
permission: Optional[Union[Permission, T_PermissionChecker]] = None,
|
||||||
*,
|
*,
|
||||||
handlers: Optional[list[Union[T_Handler, Dependent]]] = None,
|
handlers: Optional[list[Union[T_Handler, Dependent[Any]]]] = None,
|
||||||
temp: bool = False,
|
temp: bool = False,
|
||||||
expire_time: Optional[Union[datetime, timedelta]] = None,
|
expire_time: Optional[Union[datetime, timedelta]] = None,
|
||||||
priority: int = 1,
|
priority: int = 1,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def on(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -32,7 +32,7 @@ def on_metaevent(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -43,7 +43,7 @@ def on_message(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -54,7 +54,7 @@ def on_notice(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -65,7 +65,7 @@ def on_request(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -78,7 +78,7 @@ def on_startswith(
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -91,7 +91,7 @@ def on_endswith(
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -104,7 +104,7 @@ def on_fullmatch(
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -116,7 +116,7 @@ def on_keyword(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -130,7 +130,7 @@ def on_command(
|
|||||||
force_whitespace: str | bool | None = ...,
|
force_whitespace: str | bool | None = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -144,7 +144,7 @@ def on_shell_command(
|
|||||||
parser: ArgumentParser | None = ...,
|
parser: ArgumentParser | None = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -157,7 +157,7 @@ def on_regex(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -169,7 +169,7 @@ def on_type(
|
|||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
*,
|
*,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -194,7 +194,7 @@ class CommandGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -209,7 +209,7 @@ class CommandGroup(_Group):
|
|||||||
aliases: set[str | tuple[str, ...]] | None = ...,
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
||||||
force_whitespace: str | bool | None = ...,
|
force_whitespace: str | bool | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -224,7 +224,7 @@ class CommandGroup(_Group):
|
|||||||
aliases: set[str | tuple[str, ...]] | None = ...,
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
||||||
parser: ArgumentParser | None = ...,
|
parser: ArgumentParser | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -239,7 +239,7 @@ class MatcherGroup(_Group):
|
|||||||
type: str = ...,
|
type: str = ...,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -252,7 +252,7 @@ class MatcherGroup(_Group):
|
|||||||
type: str = ...,
|
type: str = ...,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -264,7 +264,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -276,7 +276,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -288,7 +288,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -300,7 +300,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -314,7 +314,7 @@ class MatcherGroup(_Group):
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -328,7 +328,7 @@ class MatcherGroup(_Group):
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -342,7 +342,7 @@ class MatcherGroup(_Group):
|
|||||||
ignorecase: bool = ...,
|
ignorecase: bool = ...,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -355,7 +355,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -370,7 +370,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -385,7 +385,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -399,7 +399,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
@@ -412,7 +412,7 @@ class MatcherGroup(_Group):
|
|||||||
*,
|
*,
|
||||||
rule: Rule | T_RuleChecker | None = ...,
|
rule: Rule | T_RuleChecker | None = ...,
|
||||||
permission: Permission | T_PermissionChecker | None = ...,
|
permission: Permission | T_PermissionChecker | None = ...,
|
||||||
handlers: list[T_Handler | Dependent] | None = ...,
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||||
temp: bool = ...,
|
temp: bool = ...,
|
||||||
expire_time: datetime | timedelta | None = ...,
|
expire_time: datetime | timedelta | None = ...,
|
||||||
priority: int = ...,
|
priority: int = ...,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ FrontMatter:
|
|||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
import contextlib
|
|
||||||
import typing as t
|
import typing as t
|
||||||
import typing_extensions as t_ext
|
import typing_extensions as t_ext
|
||||||
from typing import TYPE_CHECKING, TypeVar
|
from typing import TYPE_CHECKING, TypeVar
|
||||||
@@ -86,9 +85,7 @@ def all_literal_values(type_: type[t.Any]) -> list[t.Any]:
|
|||||||
|
|
||||||
def origin_is_annotated(origin: t.Optional[type[t.Any]]) -> bool:
|
def origin_is_annotated(origin: t.Optional[type[t.Any]]) -> bool:
|
||||||
"""判断是否是 Annotated 类型"""
|
"""判断是否是 Annotated 类型"""
|
||||||
with contextlib.suppress(TypeError):
|
return origin is t_ext.Annotated
|
||||||
return origin is not None and issubclass(origin, t_ext.Annotated)
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
NONE_TYPES = {None, type(None), t.Literal[None], t_ext.Literal[None]}
|
NONE_TYPES = {None, type(None), t.Literal[None], t_ext.Literal[None]}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Any, Optional, Annotated
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, ValidationError
|
||||||
|
|
||||||
from nonebot.compat import (
|
from nonebot.compat import (
|
||||||
DEFAULT_CONFIG,
|
DEFAULT_CONFIG,
|
||||||
Required,
|
Required,
|
||||||
FieldInfo,
|
FieldInfo,
|
||||||
|
TypeAdapter,
|
||||||
PydanticUndefined,
|
PydanticUndefined,
|
||||||
model_dump,
|
model_dump,
|
||||||
custom_validation,
|
custom_validation,
|
||||||
@@ -31,6 +32,21 @@ async def test_field_info():
|
|||||||
assert FieldInfo(test="test").extra["test"] == "test"
|
assert FieldInfo(test="test").extra["test"] == "test"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_type_adapter():
|
||||||
|
t = TypeAdapter(Annotated[int, FieldInfo(ge=1)])
|
||||||
|
|
||||||
|
assert t.validate_python(2) == 2
|
||||||
|
|
||||||
|
with pytest.raises(ValidationError):
|
||||||
|
t.validate_python(0)
|
||||||
|
|
||||||
|
assert t.validate_json("2") == 2
|
||||||
|
|
||||||
|
with pytest.raises(ValidationError):
|
||||||
|
t.validate_json("0")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_model_dump():
|
async def test_model_dump():
|
||||||
class TestModel(BaseModel):
|
class TestModel(BaseModel):
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ async def test_default(app: App):
|
|||||||
async def test_priority():
|
async def test_priority():
|
||||||
from plugins.param.priority import complex_priority
|
from plugins.param.priority import complex_priority
|
||||||
|
|
||||||
dependent = Dependent.parse(
|
dependent = Dependent[None].parse(
|
||||||
call=complex_priority,
|
call=complex_priority,
|
||||||
allow_types=[
|
allow_types=[
|
||||||
DependParam,
|
DependParam,
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
|||||||
同时,设置环境变量:
|
同时,设置环境变量:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set CUSTOM_CONFIG "config in environment variables"
|
set CUSTOM_CONFIG 'config in environment variables'
|
||||||
|
# windows powershell
|
||||||
|
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export CUSTOM_CONFIG="config in environment variables"
|
export CUSTOM_CONFIG='config in environment variables'
|
||||||
```
|
```
|
||||||
|
|
||||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set DRIVER '~fastapi+~httpx+~websockets'
|
set DRIVER '~fastapi+~httpx+~websockets'
|
||||||
|
# windows powershell
|
||||||
|
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export DRIVER='~fastapi+~httpx+~websockets'
|
export DRIVER='~fastapi+~httpx+~websockets'
|
||||||
```
|
```
|
||||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set HOST '127.0.0.1'
|
set HOST '127.0.0.1'
|
||||||
|
# windows powershell
|
||||||
|
$Env:HOST='127.0.0.1'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export HOST='127.0.0.1'
|
export HOST='127.0.0.1'
|
||||||
```
|
```
|
||||||
@@ -367,8 +373,10 @@ PORT=8080
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set PORT '8080'
|
set PORT '8080'
|
||||||
|
# windows powershell
|
||||||
|
$Env:PORT='8080'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export PORT='8080'
|
export PORT='8080'
|
||||||
```
|
```
|
||||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set LOG_LEVEL 'DEBUG'
|
set LOG_LEVEL 'DEBUG'
|
||||||
|
# windows powershell
|
||||||
|
$Env:LOG_LEVEL='DEBUG'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export LOG_LEVEL='DEBUG'
|
export LOG_LEVEL='DEBUG'
|
||||||
```
|
```
|
||||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set API_TIMEOUT '10.0'
|
set API_TIMEOUT '10.0'
|
||||||
|
# windows powershell
|
||||||
|
$Env:API_TIMEOUT='10.0'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export API_TIMEOUT='10.0'
|
export API_TIMEOUT='10.0'
|
||||||
```
|
```
|
||||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SUPERUSERS '["123123123"]'
|
set SUPERUSERS '["123123123"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SUPERUSERS='["123123123"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SUPERUSERS='["123123123"]'
|
export SUPERUSERS='["123123123"]'
|
||||||
```
|
```
|
||||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set NICKNAME '["bot"]'
|
set NICKNAME '["bot"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:NICKNAME='["bot"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export NICKNAME='["bot"]'
|
export NICKNAME='["bot"]'
|
||||||
```
|
```
|
||||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set COMMAND_START '["/", ""]'
|
set COMMAND_START '["/", ""]'
|
||||||
set COMMAND_SEP '[".", " "]'
|
set COMMAND_SEP '[".", " "]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:COMMAND_START='["/", ""]'
|
||||||
|
$Env:COMMAND_SEP='[".", " "]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export COMMAND_START='["/", ""]'
|
export COMMAND_START='["/", ""]'
|
||||||
export COMMAND_SEP='[".", " "]'
|
export COMMAND_SEP='[".", " "]'
|
||||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -31,17 +31,17 @@ require("nonebot_plugin_localstore")
|
|||||||
import nonebot_plugin_localstore as store
|
import nonebot_plugin_localstore as store
|
||||||
|
|
||||||
# 获取插件缓存目录
|
# 获取插件缓存目录
|
||||||
cache_dir = store.get_cache_dir("plugin_name")
|
cache_dir = store.get_plugin_cache_dir()
|
||||||
# 获取插件缓存文件
|
# 获取插件缓存文件
|
||||||
cache_file = store.get_cache_file("plugin_name", "file_name")
|
cache_file = store.get_plugin_cache_file("file_name")
|
||||||
# 获取插件数据目录
|
# 获取插件数据目录
|
||||||
data_dir = store.get_data_dir("plugin_name")
|
data_dir = store.get_plugin_data_dir()
|
||||||
# 获取插件数据文件
|
# 获取插件数据文件
|
||||||
data_file = store.get_data_file("plugin_name", "file_name")
|
data_file = store.get_plugin_data_file("file_name")
|
||||||
# 获取插件配置目录
|
# 获取插件配置目录
|
||||||
config_dir = store.get_config_dir("plugin_name")
|
config_dir = store.get_plugin_config_dir()
|
||||||
# 获取插件配置文件
|
# 获取插件配置文件
|
||||||
config_file = store.get_config_file("plugin_name", "file_name")
|
config_file = store.get_plugin_config_file("file_name")
|
||||||
```
|
```
|
||||||
|
|
||||||
:::danger 警告
|
:::danger 警告
|
||||||
@@ -53,9 +53,61 @@ config_file = store.get_config_file("plugin_name", "file_name")
|
|||||||
```python
|
```python
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
data_file = store.get_data_file("plugin_name", "file_name")
|
data_file = store.get_plugin_data_file("file_name")
|
||||||
# 写入文件内容
|
# 写入文件内容
|
||||||
data_file.write_text("Hello World!")
|
data_file.write_text("Hello World!")
|
||||||
# 读取文件内容
|
# 读取文件内容
|
||||||
data = data_file.read_text()
|
data = data_file.read_text()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
:::note 提示
|
||||||
|
|
||||||
|
对于嵌套插件,子插件的存储目录将位于父插件存储目录下。
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
## 配置项
|
||||||
|
|
||||||
|
### localstore_cache_dir
|
||||||
|
|
||||||
|
自定义缓存目录
|
||||||
|
|
||||||
|
默认值:
|
||||||
|
|
||||||
|
- macOS: `~/Library/Caches/<AppName>`
|
||||||
|
- Unix: `~/.cache/<AppName>` (XDG default)
|
||||||
|
- Windows: `C:\Users\<username>\AppData\Local\<AppName>\Cache`
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
LOCALSTORE_CACHE_DIR=/tmp/cache
|
||||||
|
```
|
||||||
|
|
||||||
|
### localstore_data_dir
|
||||||
|
|
||||||
|
自定义数据目录
|
||||||
|
|
||||||
|
默认值:
|
||||||
|
|
||||||
|
- macOS: `~/Library/Application Support/<AppName>`
|
||||||
|
- Unix: `~/.local/share/<AppName>` or in $XDG_DATA_HOME, if defined
|
||||||
|
- Win XP (not roaming): `C:\Documents and Settings\<username>\Application Data\<AppName>`
|
||||||
|
- Win 7 (not roaming): `C:\Users\<username>\AppData\Local\<AppName>`
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
LOCALSTORE_DATA_DIR=/tmp/data
|
||||||
|
```
|
||||||
|
|
||||||
|
### localstore_config_dir
|
||||||
|
|
||||||
|
自定义配置目录
|
||||||
|
|
||||||
|
默认值:
|
||||||
|
|
||||||
|
- macOS: same as user_data_dir
|
||||||
|
- Unix: `~/.config/<AppName>`
|
||||||
|
- Win XP (roaming): `C:\Documents and Settings\<username>\Local Settings\Application Data\<AppName>`
|
||||||
|
- Win 7 (roaming): `C:\Users\<username>\AppData\Roaming\<AppName>`
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
LOCALSTORE_CONFIG_DIR=/tmp/config
|
||||||
|
```
|
||||||
|
|||||||
@@ -5,6 +5,64 @@ toc_max_heading_level: 2
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## 最近更新
|
||||||
|
|
||||||
|
### 🚀 新功能
|
||||||
|
|
||||||
|
- Feature: 优化依赖注入在 pydantic v2 下的性能 [@yanyongyu](https://github.com/yanyongyu) ([#2870](https://github.com/nonebot/nonebot2/pull/2870))
|
||||||
|
- Feature: 添加遗漏的类型标注 [@yanyongyu](https://github.com/yanyongyu) ([#2856](https://github.com/nonebot/nonebot2/pull/2856))
|
||||||
|
|
||||||
|
### 🐛 Bug 修复
|
||||||
|
|
||||||
|
- Fix: 错误的类型标注和 annotated 处理 [@yanyongyu](https://github.com/yanyongyu) ([#2828](https://github.com/nonebot/nonebot2/pull/2828))
|
||||||
|
|
||||||
|
### 📝 文档
|
||||||
|
|
||||||
|
- Docs: 添加 Windows Powershell 设置环境变量方法 [@LeoQuote](https://github.com/LeoQuote) ([#2874](https://github.com/nonebot/nonebot2/pull/2874))
|
||||||
|
- Docs: 更新 localstore 插件文档 [@yanyongyu](https://github.com/yanyongyu) ([#2871](https://github.com/nonebot/nonebot2/pull/2871))
|
||||||
|
|
||||||
|
### 💫 杂项
|
||||||
|
|
||||||
|
- Plugin: 修改插件 system-command 信息 [@tkgs0](https://github.com/tkgs0) ([#2862](https://github.com/nonebot/nonebot2/pull/2862))
|
||||||
|
- Plugin: 修改 nonebot-plugin-fishing 插件作者 [@ALittleBot](https://github.com/ALittleBot) ([#2854](https://github.com/nonebot/nonebot2/pull/2854))
|
||||||
|
- Bot: 更新 Minecraft QQBot 信息 [@Lonely-Sails](https://github.com/Lonely-Sails) ([#2838](https://github.com/nonebot/nonebot2/pull/2838))
|
||||||
|
- Plugin: 移除 kanonbot 插件 [@SuperGuGuGu](https://github.com/SuperGuGuGu) ([#2819](https://github.com/nonebot/nonebot2/pull/2819))
|
||||||
|
- Plugin: 更新插件 sparkapi 信息 [@CCLMSY](https://github.com/CCLMSY) ([#2812](https://github.com/nonebot/nonebot2/pull/2812))
|
||||||
|
- Plugin: 修改插件 miragetank \& charpic 信息 [@1umine](https://github.com/1umine) ([#2807](https://github.com/nonebot/nonebot2/pull/2807))
|
||||||
|
|
||||||
|
### 🍻 插件发布
|
||||||
|
|
||||||
|
- Plugin: pokepoke_miss [@noneflow](https://github.com/noneflow) ([#2883](https://github.com/nonebot/nonebot2/pull/2883))
|
||||||
|
- Plugin: 聊天截图伪造 [@noneflow](https://github.com/noneflow) ([#2880](https://github.com/nonebot/nonebot2/pull/2880))
|
||||||
|
- Plugin: ba-tools [@noneflow](https://github.com/noneflow) ([#2867](https://github.com/nonebot/nonebot2/pull/2867))
|
||||||
|
- Plugin: 精华消息管理 [@noneflow](https://github.com/noneflow) ([#2873](https://github.com/nonebot/nonebot2/pull/2873))
|
||||||
|
- Plugin: B站收藏夹监视器 [@noneflow](https://github.com/noneflow) ([#2869](https://github.com/nonebot/nonebot2/pull/2869))
|
||||||
|
- Plugin: Alist [@noneflow](https://github.com/noneflow) ([#2865](https://github.com/nonebot/nonebot2/pull/2865))
|
||||||
|
- Plugin: 🦌管签到 [@noneflow](https://github.com/noneflow) ([#2859](https://github.com/nonebot/nonebot2/pull/2859))
|
||||||
|
- Plugin: 漂流瓶 [@noneflow](https://github.com/noneflow) ([#2861](https://github.com/nonebot/nonebot2/pull/2861))
|
||||||
|
- Plugin: 奇怪的小功能 [@noneflow](https://github.com/noneflow) ([#2851](https://github.com/nonebot/nonebot2/pull/2851))
|
||||||
|
- Plugin: SunoAI音乐生成 [@noneflow](https://github.com/noneflow) ([#2853](https://github.com/nonebot/nonebot2/pull/2853))
|
||||||
|
- Plugin: 谁是卷王 [@noneflow](https://github.com/noneflow) ([#2849](https://github.com/nonebot/nonebot2/pull/2849))
|
||||||
|
- Plugin: GPT-SoVITS 语音合成 [@noneflow](https://github.com/noneflow) ([#2847](https://github.com/nonebot/nonebot2/pull/2847))
|
||||||
|
- Plugin: 基于清影的AI视频生成 [@noneflow](https://github.com/noneflow) ([#2843](https://github.com/nonebot/nonebot2/pull/2843))
|
||||||
|
- Plugin: 命令行 [@noneflow](https://github.com/noneflow) ([#2840](https://github.com/nonebot/nonebot2/pull/2840))
|
||||||
|
- Plugin: exe_code [@noneflow](https://github.com/noneflow) ([#2835](https://github.com/nonebot/nonebot2/pull/2835))
|
||||||
|
- Plugin: nonebot-plugin-autopush [@noneflow](https://github.com/noneflow) ([#2833](https://github.com/nonebot/nonebot2/pull/2833))
|
||||||
|
- Plugin: vv_helper [@noneflow](https://github.com/noneflow) ([#2825](https://github.com/nonebot/nonebot2/pull/2825))
|
||||||
|
- Plugin: nonebot_plugin_game_torrent [@noneflow](https://github.com/noneflow) ([#2827](https://github.com/nonebot/nonebot2/pull/2827))
|
||||||
|
- Plugin: 每日油价 [@noneflow](https://github.com/noneflow) ([#2822](https://github.com/nonebot/nonebot2/pull/2822))
|
||||||
|
- Plugin: wordle [@noneflow](https://github.com/noneflow) ([#2818](https://github.com/nonebot/nonebot2/pull/2818))
|
||||||
|
- Plugin: 再润 [@noneflow](https://github.com/noneflow) ([#2816](https://github.com/nonebot/nonebot2/pull/2816))
|
||||||
|
- Plugin: 漫展/展览查询 [@noneflow](https://github.com/noneflow) ([#2811](https://github.com/nonebot/nonebot2/pull/2811))
|
||||||
|
- Plugin: 鸣潮wiki [@noneflow](https://github.com/noneflow) ([#2804](https://github.com/nonebot/nonebot2/pull/2804))
|
||||||
|
- Plugin: cloudfare R2 客服端 [@noneflow](https://github.com/noneflow) ([#2806](https://github.com/nonebot/nonebot2/pull/2806))
|
||||||
|
- Plugin: AnyMate小助手 [@noneflow](https://github.com/noneflow) ([#2761](https://github.com/nonebot/nonebot2/pull/2761))
|
||||||
|
|
||||||
|
### 🍻 机器人发布
|
||||||
|
|
||||||
|
- Bot: Minecraft_QQBot [@noneflow](https://github.com/noneflow) ([#2837](https://github.com/nonebot/nonebot2/pull/2837))
|
||||||
|
- Bot: 星辰 Bot [@noneflow](https://github.com/noneflow) ([#2824](https://github.com/nonebot/nonebot2/pull/2824))
|
||||||
|
|
||||||
## v2.3.2
|
## v2.3.2
|
||||||
|
|
||||||
### 🐛 Bug 修复
|
### 🐛 Bug 修复
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
|||||||
同时,设置环境变量:
|
同时,设置环境变量:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set CUSTOM_CONFIG "config in environment variables"
|
set CUSTOM_CONFIG 'config in environment variables'
|
||||||
|
# windows powershell
|
||||||
|
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export CUSTOM_CONFIG="config in environment variables"
|
export CUSTOM_CONFIG='config in environment variables'
|
||||||
```
|
```
|
||||||
|
|
||||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set DRIVER '~fastapi+~httpx+~websockets'
|
set DRIVER '~fastapi+~httpx+~websockets'
|
||||||
|
# windows powershell
|
||||||
|
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export DRIVER='~fastapi+~httpx+~websockets'
|
export DRIVER='~fastapi+~httpx+~websockets'
|
||||||
```
|
```
|
||||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set HOST '127.0.0.1'
|
set HOST '127.0.0.1'
|
||||||
|
# windows powershell
|
||||||
|
$Env:HOST='127.0.0.1'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export HOST='127.0.0.1'
|
export HOST='127.0.0.1'
|
||||||
```
|
```
|
||||||
@@ -367,8 +373,10 @@ PORT=8080
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set PORT '8080'
|
set PORT '8080'
|
||||||
|
# windows powershell
|
||||||
|
$Env:PORT='8080'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export PORT='8080'
|
export PORT='8080'
|
||||||
```
|
```
|
||||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set LOG_LEVEL 'DEBUG'
|
set LOG_LEVEL 'DEBUG'
|
||||||
|
# windows powershell
|
||||||
|
$Env:LOG_LEVEL='DEBUG'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export LOG_LEVEL='DEBUG'
|
export LOG_LEVEL='DEBUG'
|
||||||
```
|
```
|
||||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set API_TIMEOUT '10.0'
|
set API_TIMEOUT '10.0'
|
||||||
|
# windows powershell
|
||||||
|
$Env:API_TIMEOUT='10.0'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export API_TIMEOUT='10.0'
|
export API_TIMEOUT='10.0'
|
||||||
```
|
```
|
||||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SUPERUSERS '["123123123"]'
|
set SUPERUSERS '["123123123"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SUPERUSERS='["123123123"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SUPERUSERS='["123123123"]'
|
export SUPERUSERS='["123123123"]'
|
||||||
```
|
```
|
||||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set NICKNAME '["bot"]'
|
set NICKNAME '["bot"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:NICKNAME='["bot"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export NICKNAME='["bot"]'
|
export NICKNAME='["bot"]'
|
||||||
```
|
```
|
||||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set COMMAND_START '["/", ""]'
|
set COMMAND_START '["/", ""]'
|
||||||
set COMMAND_SEP '[".", " "]'
|
set COMMAND_SEP '[".", " "]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:COMMAND_START='["/", ""]'
|
||||||
|
$Env:COMMAND_SEP='[".", " "]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export COMMAND_START='["/", ""]'
|
export COMMAND_START='["/", ""]'
|
||||||
export COMMAND_SEP='[".", " "]'
|
export COMMAND_SEP='[".", " "]'
|
||||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
|||||||
同时,设置环境变量:
|
同时,设置环境变量:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set CUSTOM_CONFIG "config in environment variables"
|
set CUSTOM_CONFIG 'config in environment variables'
|
||||||
|
# windows powershell
|
||||||
|
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export CUSTOM_CONFIG="config in environment variables"
|
export CUSTOM_CONFIG='config in environment variables'
|
||||||
```
|
```
|
||||||
|
|
||||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set DRIVER '~fastapi+~httpx+~websockets'
|
set DRIVER '~fastapi+~httpx+~websockets'
|
||||||
|
# windows powershell
|
||||||
|
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export DRIVER='~fastapi+~httpx+~websockets'
|
export DRIVER='~fastapi+~httpx+~websockets'
|
||||||
```
|
```
|
||||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set HOST '127.0.0.1'
|
set HOST '127.0.0.1'
|
||||||
|
# windows powershell
|
||||||
|
$Env:HOST='127.0.0.1'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export HOST='127.0.0.1'
|
export HOST='127.0.0.1'
|
||||||
```
|
```
|
||||||
@@ -367,8 +373,10 @@ PORT=8080
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set PORT '8080'
|
set PORT '8080'
|
||||||
|
# windows powershell
|
||||||
|
$Env:PORT='8080'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export PORT='8080'
|
export PORT='8080'
|
||||||
```
|
```
|
||||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set LOG_LEVEL 'DEBUG'
|
set LOG_LEVEL 'DEBUG'
|
||||||
|
# windows powershell
|
||||||
|
$Env:LOG_LEVEL='DEBUG'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export LOG_LEVEL='DEBUG'
|
export LOG_LEVEL='DEBUG'
|
||||||
```
|
```
|
||||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set API_TIMEOUT '10.0'
|
set API_TIMEOUT '10.0'
|
||||||
|
# windows powershell
|
||||||
|
$Env:API_TIMEOUT='10.0'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export API_TIMEOUT='10.0'
|
export API_TIMEOUT='10.0'
|
||||||
```
|
```
|
||||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SUPERUSERS '["123123123"]'
|
set SUPERUSERS '["123123123"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SUPERUSERS='["123123123"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SUPERUSERS='["123123123"]'
|
export SUPERUSERS='["123123123"]'
|
||||||
```
|
```
|
||||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set NICKNAME '["bot"]'
|
set NICKNAME '["bot"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:NICKNAME='["bot"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export NICKNAME='["bot"]'
|
export NICKNAME='["bot"]'
|
||||||
```
|
```
|
||||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set COMMAND_START '["/", ""]'
|
set COMMAND_START '["/", ""]'
|
||||||
set COMMAND_SEP '[".", " "]'
|
set COMMAND_SEP '[".", " "]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:COMMAND_START='["/", ""]'
|
||||||
|
$Env:COMMAND_SEP='[".", " "]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export COMMAND_START='["/", ""]'
|
export COMMAND_START='["/", ""]'
|
||||||
export COMMAND_SEP='[".", " "]'
|
export COMMAND_SEP='[".", " "]'
|
||||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
|||||||
同时,设置环境变量:
|
同时,设置环境变量:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set CUSTOM_CONFIG "config in environment variables"
|
set CUSTOM_CONFIG 'config in environment variables'
|
||||||
|
# windows powershell
|
||||||
|
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export CUSTOM_CONFIG="config in environment variables"
|
export CUSTOM_CONFIG='config in environment variables'
|
||||||
```
|
```
|
||||||
|
|
||||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set DRIVER '~fastapi+~httpx+~websockets'
|
set DRIVER '~fastapi+~httpx+~websockets'
|
||||||
|
# windows powershell
|
||||||
|
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export DRIVER='~fastapi+~httpx+~websockets'
|
export DRIVER='~fastapi+~httpx+~websockets'
|
||||||
```
|
```
|
||||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set HOST '127.0.0.1'
|
set HOST '127.0.0.1'
|
||||||
|
# windows powershell
|
||||||
|
$Env:HOST='127.0.0.1'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export HOST='127.0.0.1'
|
export HOST='127.0.0.1'
|
||||||
```
|
```
|
||||||
@@ -367,8 +373,10 @@ PORT=8080
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set PORT '8080'
|
set PORT '8080'
|
||||||
|
# windows powershell
|
||||||
|
$Env:PORT='8080'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export PORT='8080'
|
export PORT='8080'
|
||||||
```
|
```
|
||||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set LOG_LEVEL 'DEBUG'
|
set LOG_LEVEL 'DEBUG'
|
||||||
|
# windows powershell
|
||||||
|
$Env:LOG_LEVEL='DEBUG'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export LOG_LEVEL='DEBUG'
|
export LOG_LEVEL='DEBUG'
|
||||||
```
|
```
|
||||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set API_TIMEOUT '10.0'
|
set API_TIMEOUT '10.0'
|
||||||
|
# windows powershell
|
||||||
|
$Env:API_TIMEOUT='10.0'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export API_TIMEOUT='10.0'
|
export API_TIMEOUT='10.0'
|
||||||
```
|
```
|
||||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SUPERUSERS '["123123123"]'
|
set SUPERUSERS '["123123123"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SUPERUSERS='["123123123"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SUPERUSERS='["123123123"]'
|
export SUPERUSERS='["123123123"]'
|
||||||
```
|
```
|
||||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set NICKNAME '["bot"]'
|
set NICKNAME '["bot"]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:NICKNAME='["bot"]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export NICKNAME='["bot"]'
|
export NICKNAME='["bot"]'
|
||||||
```
|
```
|
||||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set COMMAND_START '["/", ""]'
|
set COMMAND_START '["/", ""]'
|
||||||
set COMMAND_SEP '[".", " "]'
|
set COMMAND_SEP '[".", " "]'
|
||||||
|
# windows powershell
|
||||||
|
$Env:COMMAND_START='["/", ""]'
|
||||||
|
$Env:COMMAND_SEP='[".", " "]'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export COMMAND_START='["/", ""]'
|
export COMMAND_START='["/", ""]'
|
||||||
export COMMAND_SEP='[".", " "]'
|
export COMMAND_SEP='[".", " "]'
|
||||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
|||||||
<TabItem value="env" label="系统环境变量">
|
<TabItem value="env" label="系统环境变量">
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# windows
|
# windows cmd
|
||||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||||
|
# windows powershell
|
||||||
|
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
# linux/macOS
|
# linux/macOS
|
||||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||||
```
|
```
|
||||||
|
|||||||
16
yarn.lock
16
yarn.lock
@@ -1512,7 +1512,7 @@
|
|||||||
sitemap "^7.1.1"
|
sitemap "^7.1.1"
|
||||||
tslib "^2.4.0"
|
tslib "^2.4.0"
|
||||||
|
|
||||||
"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
"@docusaurus/react-loadable@5.5.2":
|
||||||
version "5.5.2"
|
version "5.5.2"
|
||||||
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
||||||
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
@@ -7620,9 +7620,9 @@ pure-color@^1.2.0:
|
|||||||
integrity sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==
|
integrity sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==
|
||||||
|
|
||||||
pyright@^1.1.317:
|
pyright@^1.1.317:
|
||||||
version "1.1.352"
|
version "1.1.372"
|
||||||
resolved "https://registry.npmjs.org/pyright/-/pyright-1.1.352.tgz#2feb37438bc79ddf2bc1fdcc139f4ba088719f14"
|
resolved "https://registry.npmjs.org/pyright/-/pyright-1.1.372.tgz#4ac7b6ca189b58629ef26445f98c6685849dda5a"
|
||||||
integrity sha512-X7fuuB24n3RIVCEPovrAadYJjxeB5RccArug+/oLwQnsHbSaDUQVHHkF/PJHkKpaIPX/RboG+EW8uCNUp1RnwQ==
|
integrity sha512-S0XYmTQWK+ha9FTIWviNk91UnbD569wPUCNEltSqtHeTJhbHj5z3LkOKiqXAOvn72BBfylcgpQqyQHsocmQtiQ==
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "~2.3.3"
|
fsevents "~2.3.3"
|
||||||
|
|
||||||
@@ -7805,6 +7805,14 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.3"
|
"@babel/runtime" "^7.10.3"
|
||||||
|
|
||||||
|
"react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
||||||
|
version "5.5.2"
|
||||||
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
||||||
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/react" "*"
|
||||||
|
prop-types "^15.6.2"
|
||||||
|
|
||||||
react-router-config@^5.1.1:
|
react-router-config@^5.1.1:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.npmjs.org/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988"
|
resolved "https://registry.npmjs.org/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988"
|
||||||
|
|||||||
Reference in New Issue
Block a user