mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2025-04-12 23:29:37 +08:00
✨ help
不显示已卸载的插件,修改import
This commit is contained in:
parent
537723ef09
commit
08ab50d152
@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from nonebot import load_plugins, get_driver, logger, load_plugin
|
from nonebot import load_plugins, get_driver, logger, load_plugin
|
||||||
from typing import List
|
from typing import List
|
||||||
from LittlePaimon.database import connect, disconnect
|
from LittlePaimon import database
|
||||||
from LittlePaimon.utils.migration import migrate_database
|
from LittlePaimon.utils.migration import migrate_database
|
||||||
from LittlePaimon.utils.tool import check_resource
|
from LittlePaimon.utils.tool import check_resource
|
||||||
|
|
||||||
|
@ -113,8 +113,10 @@ class PluginManager:
|
|||||||
logger.success('插件管理器', '<g>初始化完成</g>')
|
logger.success('插件管理器', '<g>初始化完成</g>')
|
||||||
|
|
||||||
async def get_plugin_list(self, message_type: str, session_id: int) -> List[PluginInfo]:
|
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 = 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:
|
for plugin in plugin_list:
|
||||||
if message_type == 'guild':
|
if message_type == 'guild':
|
||||||
plugin_info = await PluginPermission.get_or_none(name=plugin.module_name, session_id=session_id,
|
plugin_info = await PluginPermission.get_or_none(name=plugin.module_name, session_id=session_id,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
- 2、克隆本分支`git clone https://github.com/CMHopeSunshine/LittlePaimon -b Bot --depth=1`
|
- 2、克隆本分支`git clone https://github.com/CMHopeSunshine/LittlePaimon -b Bot --depth=1`
|
||||||
- 3、进入目录并安装依赖`poetry install`
|
- 3、进入目录并安装依赖`poetry install`
|
||||||
- 4、安装配置go-cqhttp`略`
|
- 4、安装配置go-cqhttp`略`
|
||||||
- 5、启动`nb run`
|
- 5、启动`poetry run nb run`
|
||||||
- 6、添加公共ck`添加公共ck`
|
- 6、添加公共ck`添加公共ck`
|
||||||
|
|
||||||
从旧版本迁移
|
从旧版本迁移
|
||||||
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
方法二:
|
方法二:
|
||||||
- 1、将旧版本Bot中的`LittlePaimon`文件夹删除
|
- 1、将旧版本Bot中的`LittlePaimon`文件夹删除
|
||||||
- 2、克隆或下载本分支的文件,将`LittlePaimon`、`matcher_patch.py`放到Bot文件夹中
|
- 2、克隆或下载本分支的文件,将`LittlePaimon`、`matcher_patch.py`、`requirements.txt`放到Bot目录中
|
||||||
- 3、先命令行进入虚拟环境,然后进入到Bot文件夹,运行`pip install -r requirements.txt`
|
- 3、进入虚拟环境,cd到Bot目录,运行`pip install -r requirements.txt`
|
||||||
- 4、在`bot.py`的第6行位置加一句`import matcher_patch`
|
- 4、在`bot.py`的第6行位置加一句`import matcher_patch`
|
||||||
|
- 5、将`bot.py`的`load_plugins('LittlePaimon')`的s去掉
|
Loading…
x
Reference in New Issue
Block a user