📝 add help command

This commit is contained in:
远野千束 2024-04-19 00:45:57 +08:00
parent 62a2755ecf
commit 5a9e8449cc
4 changed files with 13 additions and 9 deletions

View File

@ -52,6 +52,9 @@ npm enable-global/disable-global <plugin_name> # 全局启用/停用插件
# 群聊仅群主、管理员、超级用户可用,私聊所有人可用 # 群聊仅群主、管理员、超级用户可用,私聊所有人可用
npm enable/disable <plugin_name> # 当前会话启用/停用插件 npm enable/disable <plugin_name> # 当前会话启用/停用插件
npm list [page] [num] # 列出所有插件 page为页数num为每页显示数量 npm list [page] [num] # 列出所有插件 page为页数num为每页显示数量
# 所有人
help <plugin_name> # 查看插件帮助
``` ```
- 资源包管理 - 资源包管理
@ -71,6 +74,7 @@ rpm reload # 重载所有资源包
npm 插件管理 | update 更新 | install 安装 | uninstall 卸载 | search 搜索 npm 插件管理 | update 更新 | install 安装 | uninstall 卸载 | search 搜索
enable 启用 | disable 停用 | enable-global 全局启用 | disable-global 全局停用 enable 启用 | disable 停用 | enable-global 全局启用 | disable-global 全局停用
rpm 资源包 | load 加载 | unload 卸载 | change 更改 | reload 重载 | list 列表 rpm 资源包 | load 加载 | unload 卸载 | change 更改 | reload 重载 | list 列表
help 帮助
``` ```
> [!warning] > [!warning]

View File

@ -3,8 +3,8 @@ from typing import Optional
import pytz import pytz
from nonebot import require from nonebot import require
from liteyuki.utils.base.data import LiteModel from liteyuki.utils.base.data import LiteModel, Database
from liteyuki.utils.base.data_manager import User, user_db 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.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.base.ly_typing import T_Bot, T_MessageEvent
from liteyuki.utils.message.message import MarkdownMessage as md from liteyuki.utils.message.message import MarkdownMessage as md

View File

@ -2,14 +2,14 @@ import os
from pydantic import Field from pydantic import Field
from .data import LiteModel, Database as DB from .data import Database, LiteModel, Database
DATA_PATH = "data/liteyuki" DATA_PATH = "data/liteyuki"
user_db = DB(os.path.join(DATA_PATH, "users.ldb")) user_db = Database(os.path.join(DATA_PATH, "users.ldb"))
group_db = DB(os.path.join(DATA_PATH, "groups.ldb")) group_db = Database(os.path.join(DATA_PATH, "groups.ldb"))
plugin_db = DB(os.path.join(DATA_PATH, "plugins.ldb")) plugin_db = Database(os.path.join(DATA_PATH, "plugins.ldb"))
common_db = DB(os.path.join(DATA_PATH, "common.ldb")) common_db = Database(os.path.join(DATA_PATH, "common.ldb"))
class User(LiteModel): class User(LiteModel):

View File

@ -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 = user_db.first(User(), "user_id = ?", user_id, default=User(user_id=user_id))
user.profile["lang"] = lang_code user.profile["lang"] = lang_code
user_db.upsert(user, "user_id = ?", user_id) user_db.upsert(user)
_user_lang[user_id] = lang_code _user_lang[user_id] = lang_code