diff --git a/README.md b/README.md index c0634ea..6f10f7d 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,25 @@ [KimigaiiWuyi/GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID) 的核心部分,平台无关,支持 HTTP/WS 形式调用,便于移植到其他平台以及框架。 -本Readme的部分内容**已经失效**,请前往最新的详细文档查阅: +**💖一套业务逻辑,多个平台支持!** **🎉 [详细文档](https://docs.sayu-bot.com)** ( [快速开始(安装)](https://docs.sayu-bot.com/Started/InstallCore.html) | [链接Bot](https://docs.sayu-bot.com/LinkBots/AdapterList.html) | [插件市场](https://docs.sayu-bot.com/InstallPlugins/PluginsList.html) ) -👉 [插件编写指南](https://docs.sayu-bot.com/CodePlugins/CookBook.html) +## 优点&特色 + +- 🔀 **异步优先**:异步处理~~大量~~消息流,不会阻塞任务运行 +- 🔧 **易于开发**:即使完全没有接触过Python,也能在一小时内迅速上手 👉 [插件编写指南](https://docs.sayu-bot.com/CodePlugins/CookBook.html) +- ♻ **热重载**:修改插件配置&安装插件&更新插件,无需重启也能直接应用 +- **🌎 [网页控制台](https://docs.sayu-bot.com/Advance/WebConsole.html)**:集成网页控制台,可以通过WEB直接操作**插件数据库/配置文件/检索日志/权限控制/数据统计/批量发送** 等超多操作 +- 📄 **高度统一**:统一**所有插件**的[插件前缀](https://docs.sayu-bot.com/CodePlugins/PluginsPrefix.html)/[配置管理](https://docs.sayu-bot.com/CodePlugins/PluginsConfig.html)/[帮助图生成](https://docs.sayu-bot.com/CodePlugins/PluginsHelp.html)/权限控制/[数据库写入](https://docs.sayu-bot.com/CodePlugins/PluginsDataBase.html)/[订阅消息](https://docs.sayu-bot.com/CodePlugins/Subscribe.html),所有插件编写常见方法一应俱全,插件作者可通过简单的**继承重写**实现**高度统一**的逻辑 +- 💻 **多元适配**:借助上游Bot (NoneBot2 / Koishi / YunzaiBot) 适配,支持QQ/QQ频道/微信/Tg/Discord/飞书/KOOK/DODO/OneBot v11(v12)等多个平台,做到**一套业务逻辑,多个平台支持**! +- 🚀 **作为插件**:该项目**不能独立使用**,作为**上游Bot (NoneBot2 / Koishi / YunzaiBot)** 的插件使用,无需迁移原本Bot,保留之前全部的功能,便于充分扩展 +- 🛠 **内置命令**:借助内置命令,轻松完成**重启/状态/安装插件/更新插件/更新依赖**等操作 +- 📝 **帮助系统**:通过统一适配,可按照不同**权限输出**不同帮助,并支持插件的**二级菜单注册**至主帮助目录,并支持在帮助界面使用不同的**自定义前缀** + +
主菜单帮助示例

+ +

## 感谢 diff --git a/gsuid_core/utils/plugins_config/config_default.py b/gsuid_core/utils/plugins_config/config_default.py index 4ee22d5..1f8d894 100644 --- a/gsuid_core/utils/plugins_config/config_default.py +++ b/gsuid_core/utils/plugins_config/config_default.py @@ -83,6 +83,11 @@ CONIFG_DEFAULT: Dict[str, GSC] = { '启动Core时将会自动更新插件依赖', False, ), + 'AutoReloadPlugins': GsBoolConfig( + '自动重载插件', + 'Core内插件更新/安装时自动载入/重载', + True, + ), 'EnablePicSrv': GsBoolConfig( '启用将图片转链接发送(需公网)', '发送图片转链接', diff --git a/gsuid_core/utils/plugins_update/_plugins.py b/gsuid_core/utils/plugins_update/_plugins.py index eced9f5..10cafd2 100644 --- a/gsuid_core/utils/plugins_update/_plugins.py +++ b/gsuid_core/utils/plugins_update/_plugins.py @@ -10,6 +10,7 @@ import aiohttp from git.repo import Repo from git.exc import GitCommandError, NoSuchPathError, InvalidGitRepositoryError +from gsuid_core.gss import gss from gsuid_core.logger import logger from gsuid_core.utils.plugins_config.gs_config import core_plugins_config @@ -20,6 +21,7 @@ from .api import CORE_PATH, PLUGINS_PATH, plugins_lib plugins_list: Dict[str, Dict[str, str]] = {} is_install_dep = core_plugins_config.get_config('AutoInstallDep').data +is_reload: bool = core_plugins_config.get_config('AutoReloadPlugins').data async def check_plugin_exist(name: str): @@ -173,7 +175,9 @@ def install_plugins(plugins: Dict[str, str]) -> str: Repo.clone_from(git_path, path, **config) logger.info(f'插件{plugin_name}安装成功!') - return f'插件{plugin_name}安装成功!发送[gs重启]以应用!' + if is_reload: + gss.load_plugin(path) + return f'插件{plugin_name}安装成功!发送[gs重启]以应用! (如已开启自动重载插件则无需重启)' async def install_plugin(plugin_name: str) -> int: @@ -472,7 +476,7 @@ def update_from_git( break else: log_list.append(f'✅插件 {plugin_name} 本次无更新内容!') - if plugin_name != '早柚核心': + if plugin_name != '早柚核心' and is_reload: reload_plugin(plugin_name) return log_list