<!-- markdownlint-disable MD041 -->
<p align="center">
<a href="https://nonebot.dev/"><img src="https://nonebot.dev/logo.png" width="200" height="200" alt="nonebot"></a>
</p>
<div align="center">
# NoneBot Plugin LocalStore
<!-- prettier-ignore-start -->
<!-- markdownlint-disable-next-line MD036 -->
_✨ NoneBot 本地数据存储插件 ✨_
<!-- prettier-ignore-end -->
</div>
<p align="center">
<a href="https://raw.githubusercontent.com/nonebot/plugin-localstore/master/LICENSE">
<img src="https://img.shields.io/github/license/nonebot/plugin-localstore.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-localstore">
<img src="https://img.shields.io/pypi/v/nonebot-plugin-localstore.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
</p>
## 使用方式
加载插件后使用 `require` 声明插件依赖,直接使用 `localstore` 插件提供的函数即可。
```python
from pathlib import Path
from nonebot import require
require("nonebot_plugin_localstore")
import nonebot_plugin_localstore as store
plugin_cache_dir: Path = store.get_plugin_cache_dir()
plugin_cache_file: Path = store.get_plugin_cache_file("filename")
plugin_config_dir: Path = store.get_plugin_config_dir()
plugin_config_file: Path = store.get_plugin_config_file("filename")
plugin_data_dir: Path = store.get_plugin_data_dir()
plugin_data_file: Path = store.get_plugin_data_file("filename")
```
## 存储路径
在项目安装插件后,可以使用 `nb-cli` 查看具体的存储路径:
```bash
nb localstore
```
参考路径如下:
### cache path
- macOS: `~/Library/Caches/<AppName>`
- Unix: `~/.cache/<AppName>` (XDG default)
- Windows: `C:\Users\<username>\AppData\Local\<AppName>\Cache`
### data path
- 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>`
### config path
- 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>`
Raw data
{
"_id": null,
"home_page": "https://github.com/nonebot/plugin-localstore",
"name": "nonebot-plugin-localstore",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "nonebot2, qq, plugin",
"author": "yanyongyu",
"author_email": "yyy@nonebot.dev",
"download_url": "https://files.pythonhosted.org/packages/9f/38/c7ad15cec58aeed9ccbb0fd673d5bc9d62bed4cd9c2fa19e31b37329bfd8/nonebot_plugin_localstore-0.7.2.tar.gz",
"platform": null,
"description": "<!-- markdownlint-disable MD041 -->\n<p align=\"center\">\n <a href=\"https://nonebot.dev/\"><img src=\"https://nonebot.dev/logo.png\" width=\"200\" height=\"200\" alt=\"nonebot\"></a>\n</p>\n\n<div align=\"center\">\n\n# NoneBot Plugin LocalStore\n\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable-next-line MD036 -->\n_\u2728 NoneBot \u672c\u5730\u6570\u636e\u5b58\u50a8\u63d2\u4ef6 \u2728_\n<!-- prettier-ignore-end -->\n\n</div>\n\n<p align=\"center\">\n <a href=\"https://raw.githubusercontent.com/nonebot/plugin-localstore/master/LICENSE\">\n <img src=\"https://img.shields.io/github/license/nonebot/plugin-localstore.svg\" alt=\"license\">\n </a>\n <a href=\"https://pypi.python.org/pypi/nonebot-plugin-localstore\">\n <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-localstore.svg\" alt=\"pypi\">\n </a>\n <img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\">\n</p>\n\n## \u4f7f\u7528\u65b9\u5f0f\n\n\u52a0\u8f7d\u63d2\u4ef6\u540e\u4f7f\u7528 `require` \u58f0\u660e\u63d2\u4ef6\u4f9d\u8d56\uff0c\u76f4\u63a5\u4f7f\u7528 `localstore` \u63d2\u4ef6\u63d0\u4f9b\u7684\u51fd\u6570\u5373\u53ef\u3002\n\n```python\nfrom pathlib import Path\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_localstore\")\n\nimport nonebot_plugin_localstore as store\n\nplugin_cache_dir: Path = store.get_plugin_cache_dir()\nplugin_cache_file: Path = store.get_plugin_cache_file(\"filename\")\nplugin_config_dir: Path = store.get_plugin_config_dir()\nplugin_config_file: Path = store.get_plugin_config_file(\"filename\")\nplugin_data_dir: Path = store.get_plugin_data_dir()\nplugin_data_file: Path = store.get_plugin_data_file(\"filename\")\n```\n\n## \u5b58\u50a8\u8def\u5f84\n\n\u5728\u9879\u76ee\u5b89\u88c5\u63d2\u4ef6\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528 `nb-cli` \u67e5\u770b\u5177\u4f53\u7684\u5b58\u50a8\u8def\u5f84\uff1a\n\n```bash\nnb localstore\n```\n\n\u53c2\u8003\u8def\u5f84\u5982\u4e0b\uff1a\n\n### cache path\n\n- macOS: `~/Library/Caches/<AppName>`\n- Unix: `~/.cache/<AppName>` (XDG default)\n- Windows: `C:\\Users\\<username>\\AppData\\Local\\<AppName>\\Cache`\n\n### data path\n\n- macOS: `~/Library/Application Support/<AppName>`\n- Unix: `~/.local/share/<AppName>` or in $XDG_DATA_HOME, if defined\n- Win XP (not roaming): `C:\\Documents and Settings\\<username>\\Application Data\\<AppName>`\n- Win 7 (not roaming): `C:\\Users\\<username>\\AppData\\Local\\<AppName>`\n\n### config path\n\n- macOS: same as user_data_dir\n- Unix: `~/.config/<AppName>`\n- Win XP (roaming): `C:\\Documents and Settings\\<username>\\Local Settings\\Application Data\\<AppName>`\n- Win 7 (roaming): `C:\\Users\\<username>\\AppData\\Roaming\\<AppName>`\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Local Storage Support for NoneBot2",
"version": "0.7.2",
"project_urls": {
"Documentation": "https://github.com/nonebot/plugin-localstore#readme",
"Homepage": "https://github.com/nonebot/plugin-localstore",
"Repository": "https://github.com/nonebot/plugin-localstore"
},
"split_keywords": [
"nonebot2",
" qq",
" plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d50c8a0aabb21c726f573107d8308fd74242043f67701429d0b88126fe67586d",
"md5": "0f1ff662c815f3efb55d4b62f3c70e19",
"sha256": "b86833c8f743d9deda86648307e658e79552067f1583c1a8b9eaf75a43ee0b65"
},
"downloads": -1,
"filename": "nonebot_plugin_localstore-0.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f1ff662c815f3efb55d4b62f3c70e19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 8598,
"upload_time": "2024-11-17T15:25:24",
"upload_time_iso_8601": "2024-11-17T15:25:24.154446Z",
"url": "https://files.pythonhosted.org/packages/d5/0c/8a0aabb21c726f573107d8308fd74242043f67701429d0b88126fe67586d/nonebot_plugin_localstore-0.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f38c7ad15cec58aeed9ccbb0fd673d5bc9d62bed4cd9c2fa19e31b37329bfd8",
"md5": "5606b834ea213bcb47f32a9bd5852f74",
"sha256": "97ae717d2705f3d77ea95898c3c48fa842fd4180c3c3a9fd4c5008b8a8a7c964"
},
"downloads": -1,
"filename": "nonebot_plugin_localstore-0.7.2.tar.gz",
"has_sig": false,
"md5_digest": "5606b834ea213bcb47f32a9bd5852f74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 7035,
"upload_time": "2024-11-17T15:25:25",
"upload_time_iso_8601": "2024-11-17T15:25:25.305226Z",
"url": "https://files.pythonhosted.org/packages/9f/38/c7ad15cec58aeed9ccbb0fd673d5bc9d62bed4cd9c2fa19e31b37329bfd8/nonebot_plugin_localstore-0.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 15:25:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nonebot",
"github_project": "plugin-localstore",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nonebot-plugin-localstore"
}