From 62a2755ecf645095f1a5621f414eab9b71c8b808 Mon Sep 17 00:00:00 2001 From: snowy Date: Fri, 19 Apr 2024 00:31:49 +0800 Subject: [PATCH 1/7] :bug: fix typo `update` -> `upsert` --- liteyuki/utils/base/language.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liteyuki/utils/base/language.py b/liteyuki/utils/base/language.py index 5d58ada4..3d933f2d 100644 --- a/liteyuki/utils/base/language.py +++ b/liteyuki/utils/base/language.py @@ -149,7 +149,7 @@ def change_user_lang(user_id: str, lang_code: str): """ user = user_db.first(User(), "user_id = ?", user_id, default=User(user_id=user_id)) user.profile["lang"] = lang_code - user_db.update(user, "user_id = ?", user_id) + user_db.upsert(user, "user_id = ?", user_id) _user_lang[user_id] = lang_code From 5a9e8449cc2ce8c8b9465f6d24a4d4aa8503d2db Mon Sep 17 00:00:00 2001 From: snowy Date: Fri, 19 Apr 2024 00:45:57 +0800 Subject: [PATCH 2/7] :memo: add `help` command --- docs/usage/basic_command.md | 6 +++++- liteyuki/plugins/liteyuki_user/profile_manager.py | 4 ++-- liteyuki/utils/base/data_manager.py | 10 +++++----- liteyuki/utils/base/language.py | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/usage/basic_command.md b/docs/usage/basic_command.md index b6a1d799..e8e56763 100644 --- a/docs/usage/basic_command.md +++ b/docs/usage/basic_command.md @@ -52,6 +52,9 @@ npm enable-global/disable-global # 全局启用/停用插件 # 群聊仅群主、管理员、超级用户可用,私聊所有人可用 npm enable/disable # 当前会话启用/停用插件 npm list [page] [num] # 列出所有插件 page为页数,num为每页显示数量 + +# 所有人 +help # 查看插件帮助 ``` - 资源包管理 @@ -71,6 +74,7 @@ rpm reload # 重载所有资源包 npm 插件管理 | update 更新 | install 安装 | uninstall 卸载 | search 搜索 enable 启用 | disable 停用 | enable-global 全局启用 | disable-global 全局停用 rpm 资源包 | load 加载 | unload 卸载 | change 更改 | reload 重载 | list 列表 +help 帮助 ``` > [!warning] @@ -93,5 +97,5 @@ profile 个人信息 | set 设置 | get 查询 > [!tip] > **参数**:``为必填参数,`[option]`为可选参数。 -> +> > **命令别名**:配置了命令别名的命令可以使用别名代替原命令,例如`npm install ~`可以使用`插件 安装 ~`代替。 diff --git a/liteyuki/plugins/liteyuki_user/profile_manager.py b/liteyuki/plugins/liteyuki_user/profile_manager.py index 8564eeaf..0ce2ed90 100644 --- a/liteyuki/plugins/liteyuki_user/profile_manager.py +++ b/liteyuki/plugins/liteyuki_user/profile_manager.py @@ -3,8 +3,8 @@ from typing import Optional import pytz from nonebot import require -from liteyuki.utils.base.data import LiteModel -from liteyuki.utils.base.data_manager import User, user_db +from liteyuki.utils.base.data import LiteModel, Database +from liteyuki.utils.base.data_manager import User, user_db, group_db from liteyuki.utils.base.language import Language, change_user_lang, get_all_lang, get_user_lang from liteyuki.utils.base.ly_typing import T_Bot, T_MessageEvent from liteyuki.utils.message.message import MarkdownMessage as md diff --git a/liteyuki/utils/base/data_manager.py b/liteyuki/utils/base/data_manager.py index 15d559de..77b21a7b 100644 --- a/liteyuki/utils/base/data_manager.py +++ b/liteyuki/utils/base/data_manager.py @@ -2,14 +2,14 @@ import os from pydantic import Field -from .data import LiteModel, Database as DB +from .data import Database, LiteModel, Database DATA_PATH = "data/liteyuki" -user_db = DB(os.path.join(DATA_PATH, "users.ldb")) -group_db = DB(os.path.join(DATA_PATH, "groups.ldb")) -plugin_db = DB(os.path.join(DATA_PATH, "plugins.ldb")) -common_db = DB(os.path.join(DATA_PATH, "common.ldb")) +user_db = Database(os.path.join(DATA_PATH, "users.ldb")) +group_db = Database(os.path.join(DATA_PATH, "groups.ldb")) +plugin_db = Database(os.path.join(DATA_PATH, "plugins.ldb")) +common_db = Database(os.path.join(DATA_PATH, "common.ldb")) class User(LiteModel): diff --git a/liteyuki/utils/base/language.py b/liteyuki/utils/base/language.py index 3d933f2d..cf28bd06 100644 --- a/liteyuki/utils/base/language.py +++ b/liteyuki/utils/base/language.py @@ -149,7 +149,7 @@ def change_user_lang(user_id: str, lang_code: str): """ user = user_db.first(User(), "user_id = ?", user_id, default=User(user_id=user_id)) user.profile["lang"] = lang_code - user_db.upsert(user, "user_id = ?", user_id) + user_db.upsert(user) _user_lang[user_id] = lang_code From 4dd3b4aedc46e6498837f4cdb6d1b71070f156d7 Mon Sep 17 00:00:00 2001 From: snowy Date: Sat, 20 Apr 2024 04:10:20 +0800 Subject: [PATCH 3/7] =?UTF-8?q?:memo:=20=E6=8F=92=E4=BB=B6=E5=95=86?= =?UTF-8?q?=E5=BA=97=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/client.js | 16 +- .../.vuepress/components/plugin_item_card.vue | 126 +++++++++ docs/.vuepress/components/plugin_store.vue | 39 +++ .../{ItemCard.vue => res_item_card.vue} | 0 .../components/{store.vue => res_store.vue} | 4 +- docs/.vuepress/navbar.ts | 4 +- docs/.vuepress/sidebar.ts | 3 +- docs/package.json | 5 + docs/pnpm-lock.yaml | 256 ++++++++++++++++-- docs/store/README.md | 1 - docs/store/plugin.md | 8 + docs/store/resource.md | 7 + docs/tsconfig.json | 3 +- 13 files changed, 433 insertions(+), 39 deletions(-) create mode 100644 docs/.vuepress/components/plugin_item_card.vue create mode 100644 docs/.vuepress/components/plugin_store.vue rename docs/.vuepress/components/{ItemCard.vue => res_item_card.vue} (100%) rename docs/.vuepress/components/{store.vue => res_store.vue} (86%) create mode 100644 docs/store/plugin.md create mode 100644 docs/store/resource.md diff --git a/docs/.vuepress/client.js b/docs/.vuepress/client.js index 15af3c5e..02883d85 100644 --- a/docs/.vuepress/client.js +++ b/docs/.vuepress/client.js @@ -1,8 +1,14 @@ -import { defineClientConfig } from "vuepress/client"; -import storeComp from "./components/store.vue"; +import {defineClientConfig} from "vuepress/client"; +import resourceStoreComp from "./components/res_store.vue"; +import pluginStoreComp from "./components/plugin_store.vue"; +//导入element-plus +import ElementPlus from 'element-plus'; export default defineClientConfig({ - enhance: ({ app, router, siteData }) => { - app.component("storeComp", storeComp); - }, + enhance: ({app, router, siteData}) => { + app.component("resourceStoreComp", resourceStoreComp); + app.component("pluginStoreComp", pluginStoreComp); + app.use(ElementPlus); + + }, }); \ No newline at end of file diff --git a/docs/.vuepress/components/plugin_item_card.vue b/docs/.vuepress/components/plugin_item_card.vue new file mode 100644 index 00000000..bd8906c9 --- /dev/null +++ b/docs/.vuepress/components/plugin_item_card.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/docs/.vuepress/components/plugin_store.vue b/docs/.vuepress/components/plugin_store.vue new file mode 100644 index 00000000..2c827175 --- /dev/null +++ b/docs/.vuepress/components/plugin_store.vue @@ -0,0 +1,39 @@ + + + + + \ No newline at end of file diff --git a/docs/.vuepress/components/ItemCard.vue b/docs/.vuepress/components/res_item_card.vue similarity index 100% rename from docs/.vuepress/components/ItemCard.vue rename to docs/.vuepress/components/res_item_card.vue diff --git a/docs/.vuepress/components/store.vue b/docs/.vuepress/components/res_store.vue similarity index 86% rename from docs/.vuepress/components/store.vue rename to docs/.vuepress/components/res_store.vue index 6dc2f143..08e642eb 100644 --- a/docs/.vuepress/components/store.vue +++ b/docs/.vuepress/components/res_store.vue @@ -1,10 +1,10 @@