mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
✨ 通过 nb-cli 实现数据库一键导入导出 (#210)
* feat: 实现导出存储的订阅信息的功能 * test: 编写导出功能测试 * test: 使用tmp_path * feat: 实现导入订阅文件功能 * refactor: 将订阅导入导出部分独立出来 * fix: 修复一些拼写错误 test: 完成import的第一个测试 * feat: 将订阅导入导出函数加入nb script test: 添加cli测试 * test: 完善subs import测试 * 🐛 fix nb cli entrypoint name error * fix: 修改错误的entry_point, 关闭yaml导出时对键名的排序 * fix: 使用更简短的命令名 * 🚚 将subs_io迁移到config下 * ♻️ 不再使用抛出异常的方式创建目录 * refactor: 将subscribe_export类转为函数 * refactor: 将subscribe_import类转为函数 * refactor: 根据重写的subs_io重新调整cli * test: 调整重写subs_io后的test * chore: 清理未使用的import内容 * feat(cli): 将--yaml更改为--format * test: 调整测试 * fix(cli): 为import添加不支持格式的报错 * ⚡ improve export performace * feat: subscribes_import函数不再需要传入参数函数,而是指定为add_subscribes fix: nbesf_parser在传入str时将调用parse_raw, 否则调用parse_obj * feat: subscribes_import现在会根据nbesf_data的版本选择合适的导入方式 * fix(test): 调整测试 * feat: nb bison export命令不再将文件导出到data目录,而是当前工作目录 * docs: 增添相关文档 * fix(test): 修复错误的变量名 --------- Co-authored-by: felinae98 <731499577@qq.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"version": 1,
|
||||
"groups": [
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 234
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [
|
||||
"kaltsit",
|
||||
"amiya"
|
||||
],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"categories": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "bilibili_name",
|
||||
"target": "bilibili_id",
|
||||
"platform_name": "bilibili",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
version: 1
|
||||
groups:
|
||||
- subs:
|
||||
- categories: []
|
||||
tags: []
|
||||
target:
|
||||
default_schedule_weight: 10
|
||||
platform_name: weibo
|
||||
target: weibo_id
|
||||
target_name: weibo_name
|
||||
user:
|
||||
type: group
|
||||
uid: 12355
|
||||
- subs:
|
||||
- categories: []
|
||||
tags:
|
||||
- kaltsit
|
||||
- amiya
|
||||
target:
|
||||
default_schedule_weight: 10
|
||||
platform_name: weibo
|
||||
target: weibo_id
|
||||
target_name: weibo_name
|
||||
- categories:
|
||||
- 1
|
||||
- 2
|
||||
tags: []
|
||||
target:
|
||||
default_schedule_weight: 10
|
||||
platform_name: bilibili
|
||||
target: bilibili_id
|
||||
target_name: bilibili_name
|
||||
user:
|
||||
type: group
|
||||
uid: 23466
|
||||
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"version": 1,
|
||||
"groups": [
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 234
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"tags": [
|
||||
"kaltsit",
|
||||
"amiya"
|
||||
],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"categories": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"tags": [],
|
||||
"target": [
|
||||
{
|
||||
"target_name": "bilibili_name",
|
||||
"target": "bilibili_id",
|
||||
"platform_name": "bilibili",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": {
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name2",
|
||||
"target": "weibo_id2",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name2",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"version": 1,
|
||||
"groups": [
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 234
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [
|
||||
"kaltsit",
|
||||
"amiya"
|
||||
],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"categories": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "bilibili_name",
|
||||
"target": "bilibili_id",
|
||||
"platform_name": "bilibili",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"user": {
|
||||
"type": "group",
|
||||
"uid": 123
|
||||
},
|
||||
"subs": [
|
||||
{
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"target": {
|
||||
"target_name": "weibo_name",
|
||||
"target": "weibo_id",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"categories": [
|
||||
2,
|
||||
6
|
||||
],
|
||||
"tags": [
|
||||
"poca"
|
||||
],
|
||||
"target": {
|
||||
"target_name": "weibo_name2",
|
||||
"target": "weibo_id2",
|
||||
"platform_name": "weibo",
|
||||
"default_schedule_weight": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user