mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-10-07 03:07:07 +00:00
Compare commits
93 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
eeaf823ea9 | ||
|
2195e07998 | ||
|
70fb8fc8c6 | ||
|
b78ae1ef0d | ||
|
6af5566466 | ||
|
8ceca0a90d | ||
|
08fa6dbfc8 | ||
|
967aa758d3 | ||
|
e3b10fbdc2 | ||
|
2115e5c6ec | ||
|
41dc908032 | ||
|
2b2f24628d | ||
|
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 |
@@ -9,13 +9,12 @@
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"python.analysis.diagnosticMode": "workspace",
|
||||
"python.analysis.typeCheckingMode": "basic",
|
||||
"ruff.organizeImports": false,
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.ruff": true,
|
||||
"source.organizeImports": true
|
||||
"source.fixAll.ruff": "explicit",
|
||||
"source.organizeImports": "explicit"
|
||||
}
|
||||
},
|
||||
"[javascript]": {
|
||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +1,2 @@
|
||||
open_collective: nonebot
|
||||
custom: ["https://afdian.net/@nonebot"]
|
||||
custom: ["https://afdian.com/@nonebot"]
|
||||
|
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
@@ -35,3 +35,12 @@ updates:
|
||||
actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: devcontainers
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
groups:
|
||||
devcontainers:
|
||||
patterns:
|
||||
- "*"
|
||||
|
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"
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.5.0
|
||||
rev: v0.5.6
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
@@ -20,7 +20,7 @@ repos:
|
||||
stages: [commit]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.4.2
|
||||
rev: 24.8.0
|
||||
hooks:
|
||||
- id: black
|
||||
stages: [commit]
|
||||
|
@@ -607,5 +607,30 @@
|
||||
}
|
||||
],
|
||||
"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",
|
||||
"project_link": "nonebot-plugin-charpic",
|
||||
"author": "RafuiiChan",
|
||||
"tags": [],
|
||||
"author": "1umine",
|
||||
"tags": [
|
||||
{
|
||||
"label": "字符画",
|
||||
"color": "#ea5252"
|
||||
},
|
||||
{
|
||||
"label": "多平台适配",
|
||||
"color": "#ea5252"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
},
|
||||
{
|
||||
"module_name": "nonebot_plugin_miragetank",
|
||||
"project_link": "nonebot-plugin-miragetank",
|
||||
"author": "RafuiiChan",
|
||||
"tags": [],
|
||||
"author": "1umine",
|
||||
"tags": [
|
||||
{
|
||||
"label": "幻影坦克",
|
||||
"color": "#ea5252"
|
||||
},
|
||||
{
|
||||
"label": "多平台适配",
|
||||
"color": "#ea5252"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
},
|
||||
{
|
||||
@@ -4554,18 +4572,6 @@
|
||||
],
|
||||
"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",
|
||||
"project_link": "nonebot-plugin-mcversion",
|
||||
@@ -5563,7 +5569,7 @@
|
||||
{
|
||||
"module_name": "nonebot_plugin_fishing",
|
||||
"project_link": "nonebot-plugin-fishing",
|
||||
"author": "C14H22O",
|
||||
"author": "ALittleBot",
|
||||
"tags": [
|
||||
{
|
||||
"label": "钓鱼",
|
||||
@@ -6022,6 +6028,14 @@
|
||||
{
|
||||
"label": "AI",
|
||||
"color": "#00ff00"
|
||||
},
|
||||
{
|
||||
"label": "星火",
|
||||
"color": "#0000ff"
|
||||
},
|
||||
{
|
||||
"label": "Chat",
|
||||
"color": "#ff0000"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
@@ -6418,5 +6432,336 @@
|
||||
}
|
||||
],
|
||||
"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
|
||||
},
|
||||
{
|
||||
"module_name": "mai2_pcount",
|
||||
"project_link": "mai2_pcount",
|
||||
"author": "shengwang52005",
|
||||
"tags": [
|
||||
{
|
||||
"label": "舞萌",
|
||||
"color": "#eabf0b"
|
||||
},
|
||||
{
|
||||
"label": "机厅",
|
||||
"color": "#a60a25"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
},
|
||||
{
|
||||
"module_name": "nonebot_plugin_dify",
|
||||
"project_link": "nonebot-plugin-dify",
|
||||
"author": "gsskk",
|
||||
"tags": [
|
||||
{
|
||||
"label": "LLM",
|
||||
"color": "#ea5252"
|
||||
},
|
||||
{
|
||||
"label": "Dify",
|
||||
"color": "#ea5252"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
},
|
||||
{
|
||||
"module_name": "nonebot_plugin_looklike",
|
||||
"project_link": "nonebot-plugin-looklike",
|
||||
"author": "tkgs0",
|
||||
"tags": [],
|
||||
"is_official": false
|
||||
},
|
||||
{
|
||||
"module_name": "nonebot_plugin_wait_a_minute",
|
||||
"project_link": "nonebot-plugin-wait-a-minute",
|
||||
"author": "shoucandanghehe",
|
||||
"tags": [
|
||||
{
|
||||
"label": "hook",
|
||||
"color": "#ff5349"
|
||||
}
|
||||
],
|
||||
"is_official": false
|
||||
}
|
||||
]
|
||||
|
1146
envs/pydantic-v1/poetry.lock
generated
1146
envs/pydantic-v1/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
1146
envs/pydantic-v2/poetry.lock
generated
1146
envs/pydantic-v2/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
164
envs/test/poetry.lock
generated
164
envs/test/poetry.lock
generated
@@ -165,63 +165,83 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "coverage"
|
||||
version = "7.5.4"
|
||||
version = "7.6.1"
|
||||
description = "Code coverage measurement for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "coverage-7.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6cfb5a4f556bb51aba274588200a46e4dd6b505fb1a5f8c5ae408222eb416f99"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2174e7c23e0a454ffe12267a10732c273243b4f2d50d07544a91198f05c48f47"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2214ee920787d85db1b6a0bd9da5f8503ccc8fcd5814d90796c2f2493a2f4d2e"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1137f46adb28e3813dec8c01fefadcb8c614f33576f672962e323b5128d9a68d"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b385d49609f8e9efc885790a5a0e89f2e3ae042cdf12958b6034cc442de428d3"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b4a474f799456e0eb46d78ab07303286a84a3140e9700b9e154cfebc8f527016"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5cd64adedf3be66f8ccee418473c2916492d53cbafbfcff851cbec5a8454b136"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e564c2cf45d2f44a9da56f4e3a26b2236504a496eb4cb0ca7221cd4cc7a9aca9"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-win32.whl", hash = "sha256:7076b4b3a5f6d2b5d7f1185fde25b1e54eb66e647a1dfef0e2c2bfaf9b4c88c8"},
|
||||
{file = "coverage-7.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:018a12985185038a5b2bcafab04ab833a9a0f2c59995b3cec07e10074c78635f"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:db14f552ac38f10758ad14dd7b983dbab424e731588d300c7db25b6f89e335b5"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3257fdd8e574805f27bb5342b77bc65578e98cbc004a92232106344053f319ba"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a6612c99081d8d6134005b1354191e103ec9705d7ba2754e848211ac8cacc6b"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d45d3cbd94159c468b9b8c5a556e3f6b81a8d1af2a92b77320e887c3e7a5d080"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ed550e7442f278af76d9d65af48069f1fb84c9f745ae249c1a183c1e9d1b025c"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7a892be37ca35eb5019ec85402c3371b0f7cda5ab5056023a7f13da0961e60da"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8192794d120167e2a64721d88dbd688584675e86e15d0569599257566dec9bf0"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:820bc841faa502e727a48311948e0461132a9c8baa42f6b2b84a29ced24cc078"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-win32.whl", hash = "sha256:6aae5cce399a0f065da65c7bb1e8abd5c7a3043da9dceb429ebe1b289bc07806"},
|
||||
{file = "coverage-7.5.4-cp311-cp311-win_amd64.whl", hash = "sha256:d2e344d6adc8ef81c5a233d3a57b3c7d5181f40e79e05e1c143da143ccb6377d"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:54317c2b806354cbb2dc7ac27e2b93f97096912cc16b18289c5d4e44fc663233"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:042183de01f8b6d531e10c197f7f0315a61e8d805ab29c5f7b51a01d62782747"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6bb74ed465d5fb204b2ec41d79bcd28afccf817de721e8a807d5141c3426638"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3d45ff86efb129c599a3b287ae2e44c1e281ae0f9a9bad0edc202179bcc3a2e"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5013ed890dc917cef2c9f765c4c6a8ae9df983cd60dbb635df8ed9f4ebc9f555"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1014fbf665fef86cdfd6cb5b7371496ce35e4d2a00cda501cf9f5b9e6fced69f"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3684bc2ff328f935981847082ba4fdc950d58906a40eafa93510d1b54c08a66c"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:581ea96f92bf71a5ec0974001f900db495488434a6928a2ca7f01eee20c23805"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-win32.whl", hash = "sha256:73ca8fbc5bc622e54627314c1a6f1dfdd8db69788f3443e752c215f29fa87a0b"},
|
||||
{file = "coverage-7.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:cef4649ec906ea7ea5e9e796e68b987f83fa9a718514fe147f538cfeda76d7a7"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cdd31315fc20868c194130de9ee6bfd99755cc9565edff98ecc12585b90be882"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:02ff6e898197cc1e9fa375581382b72498eb2e6d5fc0b53f03e496cfee3fac6d"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d05c16cf4b4c2fc880cb12ba4c9b526e9e5d5bb1d81313d4d732a5b9fe2b9d53"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c5986ee7ea0795a4095ac4d113cbb3448601efca7f158ec7f7087a6c705304e4"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5df54843b88901fdc2f598ac06737f03d71168fd1175728054c8f5a2739ac3e4"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ab73b35e8d109bffbda9a3e91c64e29fe26e03e49addf5b43d85fc426dde11f9"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:aea072a941b033813f5e4814541fc265a5c12ed9720daef11ca516aeacd3bd7f"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:16852febd96acd953b0d55fc842ce2dac1710f26729b31c80b940b9afcd9896f"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-win32.whl", hash = "sha256:8f894208794b164e6bd4bba61fc98bf6b06be4d390cf2daacfa6eca0a6d2bb4f"},
|
||||
{file = "coverage-7.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:e2afe743289273209c992075a5a4913e8d007d569a406ffed0bd080ea02b0633"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b95c3a8cb0463ba9f77383d0fa8c9194cf91f64445a63fc26fb2327e1e1eb088"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3d7564cc09dd91b5a6001754a5b3c6ecc4aba6323baf33a12bd751036c998be4"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:44da56a2589b684813f86d07597fdf8a9c6ce77f58976727329272f5a01f99f7"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e16f3d6b491c48c5ae726308e6ab1e18ee830b4cdd6913f2d7f77354b33f91c8"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dbc5958cb471e5a5af41b0ddaea96a37e74ed289535e8deca404811f6cb0bc3d"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:a04e990a2a41740b02d6182b498ee9796cf60eefe40cf859b016650147908029"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ddbd2f9713a79e8e7242d7c51f1929611e991d855f414ca9996c20e44a895f7c"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:b1ccf5e728ccf83acd313c89f07c22d70d6c375a9c6f339233dcf792094bcbf7"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-win32.whl", hash = "sha256:56b4eafa21c6c175b3ede004ca12c653a88b6f922494b023aeb1e836df953ace"},
|
||||
{file = "coverage-7.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:65e528e2e921ba8fd67d9055e6b9f9e34b21ebd6768ae1c1723f4ea6ace1234d"},
|
||||
{file = "coverage-7.5.4-pp38.pp39.pp310-none-any.whl", hash = "sha256:79b356f3dd5b26f3ad23b35c75dbdaf1f9e2450b6bcefc6d0825ea0aa3f86ca5"},
|
||||
{file = "coverage-7.5.4.tar.gz", hash = "sha256:a44963520b069e12789d0faea4e9fdb1e410cdc4aab89d94f7f55cbb7fef0353"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b06079abebbc0e89e6163b8e8f0e16270124c154dc6e4a47b413dd538859af16"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cf4b19715bccd7ee27b6b120e7e9dd56037b9c0681dcc1adc9ba9db3d417fa36"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61c0abb4c85b095a784ef23fdd4aede7a2628478e7baba7c5e3deba61070a02"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f59d57baca39b32db42b83b2a7ba6f47ad9c394ec2076b084c3f029b7afca23"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a1ac0ae2b8bd743b88ed0502544847c3053d7171a3cff9228af618a068ed9c34"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e6a08c0be454c3b3beb105c0596ebdc2371fab6bb90c0c0297f4e58fd7e1012c"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-win32.whl", hash = "sha256:7bb65125fcbef8d989fa1dd0e8a060999497629ca5b0efbca209588a73356232"},
|
||||
{file = "coverage-7.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:3115a95daa9bdba70aea750db7b96b37259a81a709223c8448fa97727d546fe0"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7dea0889685db8550f839fa202744652e87c60015029ce3f60e006f8c4462c93"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed37bd3c3b063412f7620464a9ac1314d33100329f39799255fb8d3027da50d3"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85f5e9a5f8b73e2350097c3756ef7e785f55bd71205defa0bfdaf96c31616ff"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bc572be474cafb617672c43fe989d6e48d3c83af02ce8de73fff1c6bb3c198d"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f4aa8219db826ce6be7099d559f8ec311549bfc4046f7f9fe9b5cea5c581c56"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b48f312cca9621272ae49008c7f613337c53fadca647d6384cc129d2996d1133"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-win32.whl", hash = "sha256:1125ca0e5fd475cbbba3bb67ae20bd2c23a98fac4e32412883f9bcbaa81c314c"},
|
||||
{file = "coverage-7.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:8ae539519c4c040c5ffd0632784e21b2f03fc1340752af711f33e5be83a9d6c6"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:95cae0efeb032af8458fc27d191f85d1717b1d4e49f7cb226cf526ff28179778"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5621a9175cf9d0b0c84c2ef2b12e9f5f5071357c4d2ea6ca1cf01814f45d2391"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:260933720fdcd75340e7dbe9060655aff3af1f0c5d20f46b57f262ab6c86a5e8"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c44fee9975f04b33331cb8eb272827111efc8930cfd582e0320613263ca849ca"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877abb17e6339d96bf08e7a622d05095e72b71f8afd8a9fefc82cf30ed944163"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3e0cadcf6733c09154b461f1ca72d5416635e5e4ec4e536192180d34ec160f8a"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c3c02d12f837d9683e5ab2f3d9844dc57655b92c74e286c262e0fc54213c216d"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-win32.whl", hash = "sha256:e05882b70b87a18d937ca6768ff33cc3f72847cbc4de4491c8e73880766718e5"},
|
||||
{file = "coverage-7.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:b5d7b556859dd85f3a541db6a4e0167b86e7273e1cdc973e5b175166bb634fdb"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a4acd025ecc06185ba2b801f2de85546e0b8ac787cf9d3b06e7e2a69f925b106"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a6d3adcf24b624a7b778533480e32434a39ad8fa30c315208f6d3e5542aeb6e9"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0c212c49b6c10e6951362f7c6df3329f04c2b1c28499563d4035d964ab8e08c"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e81d7a3e58882450ec4186ca59a3f20a5d4440f25b1cff6f0902ad890e6748a"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b260de9790fd81e69401c2dc8b17da47c8038176a79092a89cb2b7d945d060"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a78d169acd38300060b28d600344a803628c3fd585c912cacc9ea8790fe96862"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2c09f4ce52cb99dd7505cd0fc8e0e37c77b87f46bc9c1eb03fe3bc9991085388"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6878ef48d4227aace338d88c48738a4258213cd7b74fd9a3d4d7582bb1d8a155"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-win32.whl", hash = "sha256:44df346d5215a8c0e360307d46ffaabe0f5d3502c8a1cefd700b34baf31d411a"},
|
||||
{file = "coverage-7.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:8284cf8c0dd272a247bc154eb6c95548722dce90d098c17a883ed36e67cdb129"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d3296782ca4eab572a1a4eca686d8bfb00226300dcefdf43faa25b5242ab8a3e"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:502753043567491d3ff6d08629270127e0c31d4184c4c8d98f92c26f65019962"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a89ecca80709d4076b95f89f308544ec8f7b4727e8a547913a35f16717856cb"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a318d68e92e80af8b00fa99609796fdbcdfef3629c77c6283566c6f02c6d6704"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13b0a73a0896988f053e4fbb7de6d93388e6dd292b0d87ee51d106f2c11b465b"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4421712dbfc5562150f7554f13dde997a2e932a6b5f352edcce948a815efee6f"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:166811d20dfea725e2e4baa71fffd6c968a958577848d2131f39b60043400223"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:225667980479a17db1048cb2bf8bfb39b8e5be8f164b8f6628b64f78a72cf9d3"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-win32.whl", hash = "sha256:170d444ab405852903b7d04ea9ae9b98f98ab6d7e63e1115e82620807519797f"},
|
||||
{file = "coverage-7.6.1-cp313-cp313t-win_amd64.whl", hash = "sha256:b9f222de8cded79c49bf184bdbc06630d4c58eec9459b939b4a690c82ed05657"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6db04803b6c7291985a761004e9060b2bca08da6d04f26a7f2294b8623a0c1a0"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f1adfc8ac319e1a348af294106bc6a8458a0f1633cc62a1446aebc30c5fa186a"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a95324a9de9650a729239daea117df21f4b9868ce32e63f8b650ebe6cef5595b"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b43c03669dc4618ec25270b06ecd3ee4fa94c7f9b3c14bae6571ca00ef98b0d3"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8929543a7192c13d177b770008bc4e8119f2e1f881d563fc6b6305d2d0ebe9de"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:a09ece4a69cf399510c8ab25e0950d9cf2b42f7b3cb0374f95d2e2ff594478a6"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9054a0754de38d9dbd01a46621636689124d666bad1936d76c0341f7d71bf569"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0dbde0f4aa9a16fa4d754356a8f2e36296ff4d83994b2c9d8398aa32f222f989"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-win32.whl", hash = "sha256:da511e6ad4f7323ee5702e6633085fb76c2f893aaf8ce4c51a0ba4fc07580ea7"},
|
||||
{file = "coverage-7.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:3f1156e3e8f2872197af3840d8ad307a9dd18e615dc64d9ee41696f287c57ad8"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abd5fd0db5f4dc9289408aaf34908072f805ff7792632250dcb36dc591d24255"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:547f45fa1a93154bd82050a7f3cddbc1a7a4dd2a9bf5cb7d06f4ae29fe94eaf8"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645786266c8f18a931b65bfcefdbf6952dd0dea98feee39bd188607a9d307ed2"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9e0b2df163b8ed01d515807af24f63de04bebcecbd6c3bfeff88385789fdf75a"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:609b06f178fe8e9f89ef676532760ec0b4deea15e9969bf754b37f7c40326dbc"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:702855feff378050ae4f741045e19a32d57d19f3e0676d589df0575008ea5004"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2bdb062ea438f22d99cba0d7829c2ef0af1d768d1e4a4f528087224c90b132cb"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9c56863d44bd1c4fe2abb8a4d6f5371d197f1ac0ebdee542f07f35895fc07f36"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-win32.whl", hash = "sha256:6e2cd258d7d927d09493c8df1ce9174ad01b381d4729a9d8d4e38670ca24774c"},
|
||||
{file = "coverage-7.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:06a737c882bd26d0d6ee7269b20b12f14a8704807a01056c80bb881a4b2ce6ca"},
|
||||
{file = "coverage-7.6.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:e9a6e0eb86070e8ccaedfbd9d38fec54864f3125ab95419970575b42af7541df"},
|
||||
{file = "coverage-7.6.1.tar.gz", hash = "sha256:953510dfb7b12ab69d20135a0662397f077c59b1e6379a768e97c59d852ee51d"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -248,13 +268,13 @@ packaging = ">=20.4"
|
||||
|
||||
[[package]]
|
||||
name = "exceptiongroup"
|
||||
version = "1.2.1"
|
||||
version = "1.2.2"
|
||||
description = "Backport of PEP 654 (exception groups)"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"},
|
||||
{file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"},
|
||||
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
|
||||
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
@@ -298,13 +318,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "8.0.0"
|
||||
version = "8.2.0"
|
||||
description = "Read metadata from Python packages"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "importlib_metadata-8.0.0-py3-none-any.whl", hash = "sha256:15584cf2b1bf449d98ff8a6ff1abef57bf20f3ac6454f431736cd3e660921b2f"},
|
||||
{file = "importlib_metadata-8.0.0.tar.gz", hash = "sha256:188bd24e4c346d3f0a933f275c2fec67050326a856b9a359881d7c2a697e8812"},
|
||||
{file = "importlib_metadata-8.2.0-py3-none-any.whl", hash = "sha256:11901fa0c2f97919b288679932bb64febaeacf289d18ac84dd68cb2e74213369"},
|
||||
{file = "importlib_metadata-8.2.0.tar.gz", hash = "sha256:72e8d4399996132204f9a16dcc751af254a48f8d1b20b9ff0f98d4a8f901e73d"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -514,13 +534,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "nonebot2"
|
||||
version = "2.3.1"
|
||||
version = "2.3.2"
|
||||
description = "An asynchronous python bot framework."
|
||||
optional = false
|
||||
python-versions = "<4.0,>=3.9"
|
||||
files = [
|
||||
{file = "nonebot2-2.3.1-py3-none-any.whl", hash = "sha256:91ac0abebe6c403c2443b11a49e065b79e6199460bdd61a32148366b35f81c4d"},
|
||||
{file = "nonebot2-2.3.1.tar.gz", hash = "sha256:ac5a1a1759f15310e9183b606ce6bdbe52a90287bf36a69201be548e23d41e6c"},
|
||||
{file = "nonebot2-2.3.2-py3-none-any.whl", hash = "sha256:c51aa3c1f23d8062ce6d13c8423dcb9a8bf0c44f21687916095f825da79a9a55"},
|
||||
{file = "nonebot2-2.3.2.tar.gz", hash = "sha256:af52e27e03e7fe147f2b642151eec81f264d058efe53b974eb08b5d90177cd14"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -720,13 +740,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "8.2.2"
|
||||
version = "8.3.2"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "pytest-8.2.2-py3-none-any.whl", hash = "sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343"},
|
||||
{file = "pytest-8.2.2.tar.gz", hash = "sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977"},
|
||||
{file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"},
|
||||
{file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -734,7 +754,7 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
||||
iniconfig = "*"
|
||||
packaging = "*"
|
||||
pluggy = ">=1.5,<2.0"
|
||||
pluggy = ">=1.5,<2"
|
||||
tomli = {version = ">=1", markers = "python_version < \"3.11\""}
|
||||
|
||||
[package.extras]
|
||||
@@ -742,13 +762,13 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments
|
||||
|
||||
[[package]]
|
||||
name = "pytest-asyncio"
|
||||
version = "0.23.7"
|
||||
version = "0.23.8"
|
||||
description = "Pytest support for asyncio"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "pytest_asyncio-0.23.7-py3-none-any.whl", hash = "sha256:009b48127fbe44518a547bddd25611551b0e43ccdbf1e67d12479f569832c20b"},
|
||||
{file = "pytest_asyncio-0.23.7.tar.gz", hash = "sha256:5f5c72948f4c49e7db4f29f2521d4031f1c27f86e57b046126654083d4770268"},
|
||||
{file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"},
|
||||
{file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1020,13 +1040,13 @@ multidict = ">=4.0"
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.19.2"
|
||||
version = "3.20.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "zipp-3.19.2-py3-none-any.whl", hash = "sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c"},
|
||||
{file = "zipp-3.19.2.tar.gz", hash = "sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19"},
|
||||
{file = "zipp-3.20.0-py3-none-any.whl", hash = "sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d"},
|
||||
{file = "zipp-3.20.0.tar.gz", hash = "sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
|
@@ -8,17 +8,20 @@ FrontMatter:
|
||||
"""
|
||||
|
||||
from collections.abc import Generator
|
||||
from functools import cached_property
|
||||
from dataclasses import dataclass, is_dataclass
|
||||
from typing_extensions import Self, get_args, get_origin, is_typeddict
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Union,
|
||||
Generic,
|
||||
TypeVar,
|
||||
Callable,
|
||||
Optional,
|
||||
Protocol,
|
||||
Annotated,
|
||||
overload,
|
||||
)
|
||||
|
||||
from pydantic import VERSION, BaseModel
|
||||
@@ -46,8 +49,8 @@ __all__ = (
|
||||
"DEFAULT_CONFIG",
|
||||
"FieldInfo",
|
||||
"ModelField",
|
||||
"TypeAdapter",
|
||||
"extract_field_info",
|
||||
"model_field_validate",
|
||||
"model_fields",
|
||||
"model_config",
|
||||
"model_dump",
|
||||
@@ -63,9 +66,10 @@ __autodoc__ = {
|
||||
|
||||
|
||||
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._internal._repr import display_as_type
|
||||
from pydantic import TypeAdapter, GetCoreSchemaHandler
|
||||
from pydantic.fields import FieldInfo as BaseFieldInfo
|
||||
|
||||
Required = Ellipsis
|
||||
@@ -125,6 +129,25 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
||||
"""Construct a ModelField from given infos."""
|
||||
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:
|
||||
"""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."""
|
||||
return display_as_type(self.annotation)
|
||||
|
||||
def __hash__(self) -> int:
|
||||
# Each ModelField is unique for our purposes,
|
||||
# to allow store them in a set.
|
||||
return id(self)
|
||||
def validate_value(self, value: Any) -> Any:
|
||||
"""Validate the value pass to the field."""
|
||||
return self.type_adapter.validate_python(value)
|
||||
|
||||
def extract_field_info(field_info: BaseFieldInfo) -> dict[str, Any]:
|
||||
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
||||
@@ -164,15 +186,6 @@ if PYDANTIC_V2: # pragma: pydantic-v2
|
||||
kwargs["annotation"] = field_info.rebuild_annotation()
|
||||
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]:
|
||||
"""Get field list of a model."""
|
||||
|
||||
@@ -305,6 +318,45 @@ else: # pragma: pydantic-v1
|
||||
)
|
||||
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]:
|
||||
"""Get FieldInfo init kwargs from a FieldInfo instance."""
|
||||
|
||||
@@ -314,22 +366,6 @@ else: # pragma: pydantic-v1
|
||||
kwargs.update(field_info.extra)
|
||||
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]:
|
||||
"""Get field list of a model."""
|
||||
|
||||
|
@@ -9,9 +9,9 @@ from typing import Any, Callable, ForwardRef
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from nonebot.compat import ModelField
|
||||
from nonebot.exception import TypeMisMatch
|
||||
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:
|
||||
@@ -51,6 +51,6 @@ def check_field_type(field: ModelField, value: Any) -> Any:
|
||||
"""检查字段类型是否匹配"""
|
||||
|
||||
try:
|
||||
return model_field_validate(field, value, DEFAULT_CONFIG)
|
||||
return field.validate_value(value)
|
||||
except ValueError:
|
||||
raise TypeMisMatch(field, value)
|
||||
|
@@ -15,7 +15,7 @@ def combine_driver(driver: type[D]) -> type[D]: ...
|
||||
|
||||
@overload
|
||||
def combine_driver(
|
||||
driver: type[D], _m: type[Mixin], *mixins: type[Mixin]
|
||||
driver: type[D], __m: type[Mixin], /, *mixins: type[Mixin]
|
||||
) -> type["CombinedDriver"]: ...
|
||||
|
||||
|
||||
|
@@ -76,7 +76,7 @@ T = TypeVar("T")
|
||||
current_bot: ContextVar[Bot] = ContextVar("current_bot")
|
||||
current_event: ContextVar[Event] = ContextVar("current_event")
|
||||
current_matcher: ContextVar["Matcher"] = ContextVar("current_matcher")
|
||||
current_handler: ContextVar[Dependent] = ContextVar("current_handler")
|
||||
current_handler: ContextVar[Dependent[Any]] = ContextVar("current_handler")
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@@ -102,7 +102,7 @@ class DependParam(Param):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, *args, dependent: Dependent, use_cache: bool, **kwargs: Any
|
||||
self, *args, dependent: Dependent[Any], use_cache: bool, **kwargs: Any
|
||||
) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.dependent = dependent
|
||||
@@ -114,7 +114,7 @@ class DependParam(Param):
|
||||
@classmethod
|
||||
def _from_field(
|
||||
cls,
|
||||
sub_dependent: Dependent,
|
||||
sub_dependent: Dependent[Any],
|
||||
use_cache: bool,
|
||||
validate: Union[bool, PydanticFieldInfo],
|
||||
) -> Self:
|
||||
@@ -190,7 +190,7 @@ class DependParam(Param):
|
||||
use_cache: bool = self.use_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)
|
||||
|
||||
# solve sub dependency with current cache
|
||||
|
@@ -114,7 +114,7 @@ def on(
|
||||
rule: Optional[Union[Rule, T_RuleChecker]] = 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,
|
||||
expire_time: Optional[Union[datetime, timedelta]] = None,
|
||||
priority: int = 1,
|
||||
|
@@ -21,7 +21,7 @@ def on(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
*,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -32,7 +32,7 @@ def on_metaevent(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
*,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -43,7 +43,7 @@ def on_message(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
*,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -54,7 +54,7 @@ def on_notice(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
*,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -65,7 +65,7 @@ def on_request(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
*,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -78,7 +78,7 @@ def on_startswith(
|
||||
ignorecase: bool = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -91,7 +91,7 @@ def on_endswith(
|
||||
ignorecase: bool = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -104,7 +104,7 @@ def on_fullmatch(
|
||||
ignorecase: bool = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -116,7 +116,7 @@ def on_keyword(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -130,7 +130,7 @@ def on_command(
|
||||
force_whitespace: str | bool | None = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -144,7 +144,7 @@ def on_shell_command(
|
||||
parser: ArgumentParser | None = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -157,7 +157,7 @@ def on_regex(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -169,7 +169,7 @@ def on_type(
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
*,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -194,7 +194,7 @@ class CommandGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -209,7 +209,7 @@ class CommandGroup(_Group):
|
||||
aliases: set[str | tuple[str, ...]] | None = ...,
|
||||
force_whitespace: str | bool | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -224,7 +224,7 @@ class CommandGroup(_Group):
|
||||
aliases: set[str | tuple[str, ...]] | None = ...,
|
||||
parser: ArgumentParser | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -239,7 +239,7 @@ class MatcherGroup(_Group):
|
||||
type: str = ...,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -252,7 +252,7 @@ class MatcherGroup(_Group):
|
||||
type: str = ...,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -264,7 +264,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -276,7 +276,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -288,7 +288,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -300,7 +300,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -314,7 +314,7 @@ class MatcherGroup(_Group):
|
||||
ignorecase: bool = ...,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -328,7 +328,7 @@ class MatcherGroup(_Group):
|
||||
ignorecase: bool = ...,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -342,7 +342,7 @@ class MatcherGroup(_Group):
|
||||
ignorecase: bool = ...,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -355,7 +355,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -370,7 +370,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -385,7 +385,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -399,7 +399,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
@@ -412,7 +412,7 @@ class MatcherGroup(_Group):
|
||||
*,
|
||||
rule: Rule | T_RuleChecker | None = ...,
|
||||
permission: Permission | T_PermissionChecker | None = ...,
|
||||
handlers: list[T_Handler | Dependent] | None = ...,
|
||||
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
||||
temp: bool = ...,
|
||||
expire_time: datetime | timedelta | None = ...,
|
||||
priority: int = ...,
|
||||
|
@@ -13,7 +13,6 @@ FrontMatter:
|
||||
import sys
|
||||
import types
|
||||
import warnings
|
||||
import contextlib
|
||||
import typing as t
|
||||
import typing_extensions as t_ext
|
||||
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:
|
||||
"""判断是否是 Annotated 类型"""
|
||||
with contextlib.suppress(TypeError):
|
||||
return origin is not None and issubclass(origin, t_ext.Annotated)
|
||||
return False
|
||||
return origin is t_ext.Annotated
|
||||
|
||||
|
||||
NONE_TYPES = {None, type(None), t.Literal[None], t_ext.Literal[None]}
|
||||
|
1239
poetry.lock
generated
1239
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "nonebot2"
|
||||
version = "2.3.2"
|
||||
version = "2.3.3"
|
||||
description = "An asynchronous python bot framework."
|
||||
authors = ["yanyongyu <yyy@nonebot.dev>"]
|
||||
license = "MIT"
|
||||
@@ -44,7 +44,7 @@ uvicorn = { version = ">=0.20.0,<1.0.0", extras = [
|
||||
], optional = true }
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
ruff = "^0.4.0"
|
||||
ruff = "^0.6.0"
|
||||
isort = "^5.10.1"
|
||||
black = "^24.0.0"
|
||||
nonemoji = "^0.1.2"
|
||||
|
@@ -1,13 +1,14 @@
|
||||
from typing import Any, Optional
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Optional, Annotated
|
||||
|
||||
import pytest
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ValidationError
|
||||
|
||||
from nonebot.compat import (
|
||||
DEFAULT_CONFIG,
|
||||
Required,
|
||||
FieldInfo,
|
||||
TypeAdapter,
|
||||
PydanticUndefined,
|
||||
model_dump,
|
||||
custom_validation,
|
||||
@@ -31,6 +32,21 @@ async def test_field_info():
|
||||
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
|
||||
async def test_model_dump():
|
||||
class TestModel(BaseModel):
|
||||
|
@@ -574,7 +574,7 @@ async def test_default(app: App):
|
||||
async def test_priority():
|
||||
from plugins.param.priority import complex_priority
|
||||
|
||||
dependent = Dependent.parse(
|
||||
dependent = Dependent[None].parse(
|
||||
call=complex_priority,
|
||||
allow_types=[
|
||||
DependParam,
|
||||
|
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
||||
同时,设置环境变量:
|
||||
|
||||
```bash
|
||||
# windows
|
||||
set CUSTOM_CONFIG "config in environment variables"
|
||||
# windows cmd
|
||||
set CUSTOM_CONFIG 'config in environment variables'
|
||||
# windows powershell
|
||||
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||
# linux/macOS
|
||||
export CUSTOM_CONFIG="config in environment variables"
|
||||
export CUSTOM_CONFIG='config in environment variables'
|
||||
```
|
||||
|
||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set DRIVER '~fastapi+~httpx+~websockets'
|
||||
# windows powershell
|
||||
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||
# linux/macOS
|
||||
export DRIVER='~fastapi+~httpx+~websockets'
|
||||
```
|
||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set HOST '127.0.0.1'
|
||||
# windows powershell
|
||||
$Env:HOST='127.0.0.1'
|
||||
# linux/macOS
|
||||
export HOST='127.0.0.1'
|
||||
```
|
||||
@@ -367,8 +373,10 @@ PORT=8080
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set PORT '8080'
|
||||
# windows powershell
|
||||
$Env:PORT='8080'
|
||||
# linux/macOS
|
||||
export PORT='8080'
|
||||
```
|
||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set LOG_LEVEL 'DEBUG'
|
||||
# windows powershell
|
||||
$Env:LOG_LEVEL='DEBUG'
|
||||
# linux/macOS
|
||||
export LOG_LEVEL='DEBUG'
|
||||
```
|
||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set API_TIMEOUT '10.0'
|
||||
# windows powershell
|
||||
$Env:API_TIMEOUT='10.0'
|
||||
# linux/macOS
|
||||
export API_TIMEOUT='10.0'
|
||||
```
|
||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SUPERUSERS '["123123123"]'
|
||||
# windows powershell
|
||||
$Env:SUPERUSERS='["123123123"]'
|
||||
# linux/macOS
|
||||
export SUPERUSERS='["123123123"]'
|
||||
```
|
||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set NICKNAME '["bot"]'
|
||||
# windows powershell
|
||||
$Env:NICKNAME='["bot"]'
|
||||
# linux/macOS
|
||||
export NICKNAME='["bot"]'
|
||||
```
|
||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set COMMAND_START '["/", ""]'
|
||||
set COMMAND_SEP '[".", " "]'
|
||||
# windows powershell
|
||||
$Env:COMMAND_START='["/", ""]'
|
||||
$Env:COMMAND_SEP='[".", " "]'
|
||||
# linux/macOS
|
||||
export COMMAND_START='["/", ""]'
|
||||
export COMMAND_SEP='[".", " "]'
|
||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||
# windows powershell
|
||||
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
# linux/macOS
|
||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
```
|
||||
|
@@ -31,17 +31,17 @@ require("nonebot_plugin_localstore")
|
||||
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 警告
|
||||
@@ -53,9 +53,61 @@ config_file = store.get_config_file("plugin_name", "file_name")
|
||||
```python
|
||||
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 = 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,69 @@ toc_max_heading_level: 2
|
||||
|
||||
# 更新日志
|
||||
|
||||
## v2.3.3
|
||||
|
||||
### 🚀 新功能
|
||||
|
||||
- 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: nonebot-plugin-wait-a-minute [@noneflow](https://github.com/noneflow) ([#2902](https://github.com/nonebot/nonebot2/pull/2902))
|
||||
- Plugin: 你看我像 [@noneflow](https://github.com/noneflow) ([#2895](https://github.com/nonebot/nonebot2/pull/2895))
|
||||
- Plugin: dify插件 [@noneflow](https://github.com/noneflow) ([#2889](https://github.com/nonebot/nonebot2/pull/2889))
|
||||
- Plugin: mai2_pcount [@noneflow](https://github.com/noneflow) ([#2891](https://github.com/nonebot/nonebot2/pull/2891))
|
||||
- Plugin: nonebot-plugin-ehentai-search [@noneflow](https://github.com/noneflow) ([#2885](https://github.com/nonebot/nonebot2/pull/2885))
|
||||
- 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
|
||||
|
||||
### 🐛 Bug 修复
|
||||
|
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
||||
同时,设置环境变量:
|
||||
|
||||
```bash
|
||||
# windows
|
||||
set CUSTOM_CONFIG "config in environment variables"
|
||||
# windows cmd
|
||||
set CUSTOM_CONFIG 'config in environment variables'
|
||||
# windows powershell
|
||||
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||
# linux/macOS
|
||||
export CUSTOM_CONFIG="config in environment variables"
|
||||
export CUSTOM_CONFIG='config in environment variables'
|
||||
```
|
||||
|
||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set DRIVER '~fastapi+~httpx+~websockets'
|
||||
# windows powershell
|
||||
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||
# linux/macOS
|
||||
export DRIVER='~fastapi+~httpx+~websockets'
|
||||
```
|
||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set HOST '127.0.0.1'
|
||||
# windows powershell
|
||||
$Env:HOST='127.0.0.1'
|
||||
# linux/macOS
|
||||
export HOST='127.0.0.1'
|
||||
```
|
||||
@@ -367,8 +373,10 @@ PORT=8080
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set PORT '8080'
|
||||
# windows powershell
|
||||
$Env:PORT='8080'
|
||||
# linux/macOS
|
||||
export PORT='8080'
|
||||
```
|
||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set LOG_LEVEL 'DEBUG'
|
||||
# windows powershell
|
||||
$Env:LOG_LEVEL='DEBUG'
|
||||
# linux/macOS
|
||||
export LOG_LEVEL='DEBUG'
|
||||
```
|
||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set API_TIMEOUT '10.0'
|
||||
# windows powershell
|
||||
$Env:API_TIMEOUT='10.0'
|
||||
# linux/macOS
|
||||
export API_TIMEOUT='10.0'
|
||||
```
|
||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SUPERUSERS '["123123123"]'
|
||||
# windows powershell
|
||||
$Env:SUPERUSERS='["123123123"]'
|
||||
# linux/macOS
|
||||
export SUPERUSERS='["123123123"]'
|
||||
```
|
||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set NICKNAME '["bot"]'
|
||||
# windows powershell
|
||||
$Env:NICKNAME='["bot"]'
|
||||
# linux/macOS
|
||||
export NICKNAME='["bot"]'
|
||||
```
|
||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set COMMAND_START '["/", ""]'
|
||||
set COMMAND_SEP '[".", " "]'
|
||||
# windows powershell
|
||||
$Env:COMMAND_START='["/", ""]'
|
||||
$Env:COMMAND_SEP='[".", " "]'
|
||||
# linux/macOS
|
||||
export COMMAND_START='["/", ""]'
|
||||
export COMMAND_SEP='[".", " "]'
|
||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||
# windows powershell
|
||||
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
# linux/macOS
|
||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
```
|
||||
|
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
||||
同时,设置环境变量:
|
||||
|
||||
```bash
|
||||
# windows
|
||||
set CUSTOM_CONFIG "config in environment variables"
|
||||
# windows cmd
|
||||
set CUSTOM_CONFIG 'config in environment variables'
|
||||
# windows powershell
|
||||
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||
# linux/macOS
|
||||
export CUSTOM_CONFIG="config in environment variables"
|
||||
export CUSTOM_CONFIG='config in environment variables'
|
||||
```
|
||||
|
||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set DRIVER '~fastapi+~httpx+~websockets'
|
||||
# windows powershell
|
||||
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||
# linux/macOS
|
||||
export DRIVER='~fastapi+~httpx+~websockets'
|
||||
```
|
||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set HOST '127.0.0.1'
|
||||
# windows powershell
|
||||
$Env:HOST='127.0.0.1'
|
||||
# linux/macOS
|
||||
export HOST='127.0.0.1'
|
||||
```
|
||||
@@ -367,8 +373,10 @@ PORT=8080
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set PORT '8080'
|
||||
# windows powershell
|
||||
$Env:PORT='8080'
|
||||
# linux/macOS
|
||||
export PORT='8080'
|
||||
```
|
||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set LOG_LEVEL 'DEBUG'
|
||||
# windows powershell
|
||||
$Env:LOG_LEVEL='DEBUG'
|
||||
# linux/macOS
|
||||
export LOG_LEVEL='DEBUG'
|
||||
```
|
||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set API_TIMEOUT '10.0'
|
||||
# windows powershell
|
||||
$Env:API_TIMEOUT='10.0'
|
||||
# linux/macOS
|
||||
export API_TIMEOUT='10.0'
|
||||
```
|
||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SUPERUSERS '["123123123"]'
|
||||
# windows powershell
|
||||
$Env:SUPERUSERS='["123123123"]'
|
||||
# linux/macOS
|
||||
export SUPERUSERS='["123123123"]'
|
||||
```
|
||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set NICKNAME '["bot"]'
|
||||
# windows powershell
|
||||
$Env:NICKNAME='["bot"]'
|
||||
# linux/macOS
|
||||
export NICKNAME='["bot"]'
|
||||
```
|
||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set COMMAND_START '["/", ""]'
|
||||
set COMMAND_SEP '[".", " "]'
|
||||
# windows powershell
|
||||
$Env:COMMAND_START='["/", ""]'
|
||||
$Env:COMMAND_SEP='[".", " "]'
|
||||
# linux/macOS
|
||||
export COMMAND_START='["/", ""]'
|
||||
export COMMAND_SEP='[".", " "]'
|
||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||
# windows powershell
|
||||
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
# linux/macOS
|
||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
```
|
||||
|
@@ -103,6 +103,18 @@ description: nonebot.compat 模块
|
||||
|
||||
- Any
|
||||
|
||||
### _method_ `validate_value(value)` {#ModelField-validate-value}
|
||||
|
||||
- **说明:** Validate the value pass to the field.
|
||||
|
||||
- **参数**
|
||||
|
||||
- `value` (Any)
|
||||
|
||||
- **返回**
|
||||
|
||||
- Any
|
||||
|
||||
## _def_ `extract_field_info(field_info)` {#extract-field-info}
|
||||
|
||||
- **说明:** Get FieldInfo init kwargs from a FieldInfo instance.
|
||||
@@ -115,22 +127,6 @@ description: nonebot.compat 模块
|
||||
|
||||
- dict[str, Any]
|
||||
|
||||
## _def_ `model_field_validate(model_field, value, config=None)` {#model-field-validate}
|
||||
|
||||
- **说明:** Validate the value pass to the field.
|
||||
|
||||
- **参数**
|
||||
|
||||
- `model_field` (ModelField)
|
||||
|
||||
- `value` (Any)
|
||||
|
||||
- `config` (ConfigDict | None)
|
||||
|
||||
- **返回**
|
||||
|
||||
- Any
|
||||
|
||||
## _def_ `model_fields(model)` {#model-fields}
|
||||
|
||||
- **说明:** Get field list of a model.
|
@@ -503,13 +503,13 @@ description: nonebot.drivers 模块
|
||||
|
||||
- type[D]
|
||||
|
||||
**2.** `(driver, _m, *mixins) -> type[CombinedDriver]`
|
||||
**2.** `(driver, __m, /, *mixins) -> type[CombinedDriver]`
|
||||
|
||||
- **参数**
|
||||
|
||||
- `driver` (type[D])
|
||||
|
||||
- `_m` (type[[Mixin](#Mixin)])
|
||||
- `__m` (type[[Mixin](#Mixin)])
|
||||
|
||||
- `*mixins` (type[[Mixin](#Mixin)])
|
||||
|
@@ -155,7 +155,7 @@ description: nonebot.params 模块
|
||||
|
||||
- `*args`
|
||||
|
||||
- `dependent` ([Dependent](dependencies/index.md#Dependent))
|
||||
- `dependent` ([Dependent](dependencies/index.md#Dependent)[Any])
|
||||
|
||||
- `use_cache` (bool)
|
||||
|
@@ -75,7 +75,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -101,7 +101,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -127,7 +127,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -153,7 +153,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -179,7 +179,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -209,7 +209,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -239,7 +239,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -269,7 +269,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -297,7 +297,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -333,7 +333,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -372,7 +372,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -406,7 +406,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -434,7 +434,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -462,7 +462,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None)
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None)
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None)
|
||||
|
||||
- `temp` (bool)
|
||||
|
||||
@@ -490,7 +490,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -522,7 +522,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -548,7 +548,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None)
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None)
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None)
|
||||
|
||||
- `temp` (bool)
|
||||
|
||||
@@ -572,7 +572,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -598,7 +598,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -624,7 +624,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -650,7 +650,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -676,7 +676,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -706,7 +706,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -736,7 +736,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -766,7 +766,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -794,7 +794,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -830,7 +830,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -869,7 +869,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -903,7 +903,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
||||
@@ -931,7 +931,7 @@ description: nonebot.plugin.on 模块
|
||||
|
||||
- `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限
|
||||
|
||||
- `handlers` (list[[T_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表
|
||||
- `handlers` (list[[T\_Handler](../typing.md#T-Handler) | [Dependent](../dependencies/index.md#Dependent)[Any]] | None): 事件处理函数列表
|
||||
|
||||
- `temp` (bool): 是否为临时事件响应器(仅执行一次)
|
||||
|
@@ -106,6 +106,12 @@ description: nonebot.typing 模块
|
||||
|
||||
- Any
|
||||
|
||||
## _class_ `StateFlag(<auto>)` {#StateFlag}
|
||||
|
||||
- **参数**
|
||||
|
||||
auto
|
||||
|
||||
## _var_ `T_State` {#T-State}
|
||||
|
||||
- **类型:** dict[Any, Any]
|
@@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
|
||||
同时,设置环境变量:
|
||||
|
||||
```bash
|
||||
# windows
|
||||
set CUSTOM_CONFIG "config in environment variables"
|
||||
# windows cmd
|
||||
set CUSTOM_CONFIG 'config in environment variables'
|
||||
# windows powershell
|
||||
$Env:CUSTOM_CONFIG='config in environment variables'
|
||||
# linux/macOS
|
||||
export CUSTOM_CONFIG="config in environment variables"
|
||||
export CUSTOM_CONFIG='config in environment variables'
|
||||
```
|
||||
|
||||
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
|
||||
@@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set DRIVER '~fastapi+~httpx+~websockets'
|
||||
# windows powershell
|
||||
$Env:DRIVER='~fastapi+~httpx+~websockets'
|
||||
# linux/macOS
|
||||
export DRIVER='~fastapi+~httpx+~websockets'
|
||||
```
|
||||
@@ -331,8 +335,10 @@ HOST=127.0.0.1
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set HOST '127.0.0.1'
|
||||
# windows powershell
|
||||
$Env:HOST='127.0.0.1'
|
||||
# linux/macOS
|
||||
export HOST='127.0.0.1'
|
||||
```
|
||||
@@ -367,8 +373,10 @@ PORT=8080
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set PORT '8080'
|
||||
# windows powershell
|
||||
$Env:PORT='8080'
|
||||
# linux/macOS
|
||||
export PORT='8080'
|
||||
```
|
||||
@@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set LOG_LEVEL 'DEBUG'
|
||||
# windows powershell
|
||||
$Env:LOG_LEVEL='DEBUG'
|
||||
# linux/macOS
|
||||
export LOG_LEVEL='DEBUG'
|
||||
```
|
||||
@@ -443,8 +453,10 @@ API_TIMEOUT=10.0
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set API_TIMEOUT '10.0'
|
||||
# windows powershell
|
||||
$Env:API_TIMEOUT='10.0'
|
||||
# linux/macOS
|
||||
export API_TIMEOUT='10.0'
|
||||
```
|
||||
@@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SUPERUSERS '["123123123"]'
|
||||
# windows powershell
|
||||
$Env:SUPERUSERS='["123123123"]'
|
||||
# linux/macOS
|
||||
export SUPERUSERS='["123123123"]'
|
||||
```
|
||||
@@ -515,8 +529,10 @@ NICKNAME=["bot"]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set NICKNAME '["bot"]'
|
||||
# windows powershell
|
||||
$Env:NICKNAME='["bot"]'
|
||||
# linux/macOS
|
||||
export NICKNAME='["bot"]'
|
||||
```
|
||||
@@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set COMMAND_START '["/", ""]'
|
||||
set COMMAND_SEP '[".", " "]'
|
||||
# windows powershell
|
||||
$Env:COMMAND_START='["/", ""]'
|
||||
$Env:COMMAND_SEP='[".", " "]'
|
||||
# linux/macOS
|
||||
export COMMAND_START='["/", ""]'
|
||||
export COMMAND_SEP='[".", " "]'
|
||||
@@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
|
||||
<TabItem value="env" label="系统环境变量">
|
||||
|
||||
```bash
|
||||
# windows
|
||||
# windows cmd
|
||||
set SESSION_EXPIRE_TIMEOUT '00:02:00'
|
||||
# windows powershell
|
||||
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
# linux/macOS
|
||||
export SESSION_EXPIRE_TIMEOUT='00:02:00'
|
||||
```
|
@@ -487,7 +487,7 @@ matcher = on_alconna(
|
||||
|
||||
```python
|
||||
from nonebot_plugin_alconna import Match, on_alconna
|
||||
from nonebot_plugin_alconna.builtins.plugins.discord import DiscordSlashExtension
|
||||
from nonebot_plugin_alconna.builtins.extensions.discord import DiscordSlashExtension
|
||||
|
||||
|
||||
alc = Alconna(
|
@@ -31,17 +31,17 @@ require("nonebot_plugin_localstore")
|
||||
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 警告
|
||||
@@ -53,9 +53,61 @@ config_file = store.get_config_file("plugin_name", "file_name")
|
||||
```python
|
||||
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 = 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
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user