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