Skip to content

Commit

Permalink
✨ 没有加载成功的插件时不展示加载成功日志 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-kirami committed Sep 9, 2023
1 parent 2e7e2bf commit 49ea749
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kirami/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,14 @@ def load_plugins(self) -> None:

def loading_state(self, plugins: set[Plugin]) -> None:
"""打印插件加载状态"""
logger.opt(colors=True).info(
f"🌟 [magenta]Total {len(nonebot.get_loaded_plugins())} plugin are successfully loaded.[/]"
)

failed_plugins = plugins - nonebot.get_loaded_plugins()
if loaded_plugins := nonebot.get_loaded_plugins():
logger.opt(colors=True).info(
f"🌟 [magenta]Total {len(loaded_plugins)} plugin are successfully loaded.[/]"
)

if failed_total := len(failed_plugins):
if failed_plugins := plugins - loaded_plugins:
logger.opt(colors=True).error(
f"🌠 [magenta]Total {failed_total} plugin are failed loaded.[/]: {', '.join(plugin.name for plugin in failed_plugins)}"
f"🌠 [magenta]Total {len(failed_plugins)} plugin are failed loaded.[/]: {', '.join(plugin.name for plugin in failed_plugins)}"
)

def show_logo(self) -> None:
Expand Down

0 comments on commit 49ea749

Please sign in to comment.