mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-04 19:17:36 +08:00
🎨 配置新增自动重载插件
, 开启后更新插件
,安装插件
将无需重启, 自动重载注册
This commit is contained in:
parent
0bc16c06b9
commit
e76b1e86cc
18
README.md
18
README.md
@ -7,11 +7,25 @@
|
|||||||
|
|
||||||
[KimigaiiWuyi/GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID) 的核心部分,平台无关,支持 HTTP/WS 形式调用,便于移植到其他平台以及框架。
|
[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)** ( [快速开始(安装)](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,保留之前全部的功能,便于充分扩展
|
||||||
|
- 🛠 **内置命令**:借助内置命令,轻松完成**重启/状态/安装插件/更新插件/更新依赖**等操作
|
||||||
|
- 📝 **帮助系统**:通过统一适配,可按照不同**权限输出**不同帮助,并支持插件的**二级菜单注册**至主帮助目录,并支持在帮助界面使用不同的**自定义前缀**
|
||||||
|
|
||||||
|
<details><summary>主菜单帮助示例</summary><p>
|
||||||
|
<a><img src="https://s2.loli.net/2025/02/07/glxaJyS6325zvbG.jpg"></a>
|
||||||
|
</p></details>
|
||||||
|
|
||||||
## 感谢
|
## 感谢
|
||||||
|
|
||||||
|
@ -83,6 +83,11 @@ CONIFG_DEFAULT: Dict[str, GSC] = {
|
|||||||
'启动Core时将会自动更新插件依赖',
|
'启动Core时将会自动更新插件依赖',
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
|
'AutoReloadPlugins': GsBoolConfig(
|
||||||
|
'自动重载插件',
|
||||||
|
'Core内插件更新/安装时自动载入/重载',
|
||||||
|
True,
|
||||||
|
),
|
||||||
'EnablePicSrv': GsBoolConfig(
|
'EnablePicSrv': GsBoolConfig(
|
||||||
'启用将图片转链接发送(需公网)',
|
'启用将图片转链接发送(需公网)',
|
||||||
'发送图片转链接',
|
'发送图片转链接',
|
||||||
|
@ -10,6 +10,7 @@ import aiohttp
|
|||||||
from git.repo import Repo
|
from git.repo import Repo
|
||||||
from git.exc import GitCommandError, NoSuchPathError, InvalidGitRepositoryError
|
from git.exc import GitCommandError, NoSuchPathError, InvalidGitRepositoryError
|
||||||
|
|
||||||
|
from gsuid_core.gss import gss
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
from gsuid_core.utils.plugins_config.gs_config import core_plugins_config
|
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]] = {}
|
plugins_list: Dict[str, Dict[str, str]] = {}
|
||||||
|
|
||||||
is_install_dep = core_plugins_config.get_config('AutoInstallDep').data
|
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):
|
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)
|
Repo.clone_from(git_path, path, **config)
|
||||||
logger.info(f'插件{plugin_name}安装成功!')
|
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:
|
async def install_plugin(plugin_name: str) -> int:
|
||||||
@ -472,7 +476,7 @@ def update_from_git(
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
log_list.append(f'✅插件 {plugin_name} 本次无更新内容!')
|
log_list.append(f'✅插件 {plugin_name} 本次无更新内容!')
|
||||||
if plugin_name != '早柚核心':
|
if plugin_name != '早柚核心' and is_reload:
|
||||||
reload_plugin(plugin_name)
|
reload_plugin(plugin_name)
|
||||||
return log_list
|
return log_list
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user