<!-- 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/38/18/4656dc5ac000d04ba0f00cf0a54ab0f4f381f0453d6cad6e04736f43991e/nonebot_plugin_localstore-0.7.1.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.1",
"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": "fbaaa00d2ddfd96008d2fb6d50031f9cb97a2c55621e6fb36dae6b6cb8a50384",
"md5": "19f4fe0e48d0c5c6643d375ae4d6e2db",
"sha256": "7908af162d1d0e8c736ae8863723325d057289f6b080ae44ff9ff39294f9ed16"
},
"downloads": -1,
"filename": "nonebot_plugin_localstore-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "19f4fe0e48d0c5c6643d375ae4d6e2db",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 8597,
"upload_time": "2024-08-03T05:21:43",
"upload_time_iso_8601": "2024-08-03T05:21:43.862214Z",
"url": "https://files.pythonhosted.org/packages/fb/aa/a00d2ddfd96008d2fb6d50031f9cb97a2c55621e6fb36dae6b6cb8a50384/nonebot_plugin_localstore-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "38184656dc5ac000d04ba0f00cf0a54ab0f4f381f0453d6cad6e04736f43991e",
"md5": "cb3b42b48871ef0544e6b7464c37ac52",
"sha256": "9c2a7b39b50240896d9306adb79d8047308d0e77b88e3272b19be4908bdaabc9"
},
"downloads": -1,
"filename": "nonebot_plugin_localstore-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "cb3b42b48871ef0544e6b7464c37ac52",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 7037,
"upload_time": "2024-08-03T05:21:45",
"upload_time_iso_8601": "2024-08-03T05:21:45.282298Z",
"url": "https://files.pythonhosted.org/packages/38/18/4656dc5ac000d04ba0f00cf0a54ab0f4f381f0453d6cad6e04736f43991e/nonebot_plugin_localstore-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-03 05:21:45",
"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"
}