help不显示已卸载的插件,修改import

This commit is contained in:
CMHopeSunshine 2022-08-24 23:29:28 +08:00
parent 537723ef09
commit 08ab50d152
3 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@ from pathlib import Path
from nonebot import load_plugins, get_driver, logger, load_plugin
from typing import List
from LittlePaimon.database import connect, disconnect
from LittlePaimon import database
from LittlePaimon.utils.migration import migrate_database
from LittlePaimon.utils.tool import check_resource

View File

@ -113,8 +113,10 @@ class PluginManager:
logger.success('插件管理器', '<g>初始化完成</g>')
async def get_plugin_list(self, message_type: str, session_id: int) -> List[PluginInfo]:
load_plugins = nb_plugin.get_loaded_plugins()
load_plugins = [p.name for p in load_plugins]
plugin_list = sorted(self.data.values(), key=lambda x: x.priority).copy()
plugin_list = [p for p in plugin_list if p.show]
plugin_list = [p for p in plugin_list if p.show and p.module_name in load_plugins]
for plugin in plugin_list:
if message_type == 'guild':
plugin_info = await PluginPermission.get_or_none(name=plugin.module_name, session_id=session_id,

View File

@ -31,7 +31,7 @@
- 2、克隆本分支`git clone https://github.com/CMHopeSunshine/LittlePaimon -b Bot --depth=1`
- 3、进入目录并安装依赖`poetry install`
- 4、安装配置go-cqhttp`略`
- 5、启动`nb run`
- 5、启动`poetry run nb run`
- 6、添加公共ck`添加公共ck`
从旧版本迁移
@ -43,6 +43,7 @@
方法二:
- 1、将旧版本Bot中的`LittlePaimon`文件夹删除
- 2、克隆或下载本分支的文件将`LittlePaimon`、`matcher_patch.py`放到Bot文件夹中
- 3、先命令行进入虚拟环境然后进入到Bot文件夹运行`pip install -r requirements.txt`
- 4、在`bot.py`的第6行位置加一句`import matcher_patch`
- 2、克隆或下载本分支的文件将`LittlePaimon`、`matcher_patch.py`、`requirements.txt`放到Bot目录中
- 3、进入虚拟环境cd到Bot目录运行`pip install -r requirements.txt`
- 4、在`bot.py`的第6行位置加一句`import matcher_patch`
- 5、将`bot.py`的`load_plugins('LittlePaimon')`的s去掉