forked from mttu-developers/konabot
25 lines
637 B
Python
25 lines
637 B
Python
from pathlib import Path
|
|
|
|
import nonebot
|
|
from loguru import logger
|
|
|
|
nonebot.init()
|
|
nonebot.load_plugins("konabot/plugins")
|
|
|
|
plugins = nonebot.get_loaded_plugins()
|
|
len_requires = len(
|
|
[
|
|
f
|
|
for f in (Path(__file__).parent.parent / "konabot" / "plugins").iterdir()
|
|
if (f.is_dir() and (f / "__init__.py").exists())
|
|
or ((not f.is_dir()) and f.suffix == ".py")
|
|
]
|
|
)
|
|
|
|
plugins = [p for p in plugins if p.module.__name__.startswith("konabot.plugins")]
|
|
|
|
logger.info(f"已经加载的插件数量 {len(plugins)}")
|
|
logger.info(f"期待加载的插件数量 {len_requires}")
|
|
|
|
assert len(plugins) == len_requires
|