diff --git a/nonebot/plugin/manager.py b/nonebot/plugin/manager.py index 572879cf..7fe86a38 100644 --- a/nonebot/plugin/manager.py +++ b/nonebot/plugin/manager.py @@ -148,14 +148,21 @@ class PluginManager: else: raise RuntimeError(f"Plugin not found: {name}! Check your plugin name") - logger.opt(colors=True).success( - f'Succeeded to import "{escape_tag(name)}"' - ) - if (plugin := getattr(module, "__plugin__", None)) is None: + if ( + plugin := getattr(module, "__plugin__", None) + ) is None or not isinstance(plugin, Plugin): raise RuntimeError( f"Module {module.__name__} is not loaded as a plugin! " "Make sure not to import it before loading." ) + logger.opt(colors=True).success( + f'Succeeded to load plugin "{escape_tag(plugin.name)}"' + + ( + f' from "{escape_tag(plugin.module_name)}"' + if plugin.module_name != plugin.name + else "" + ) + ) return plugin except Exception as e: logger.opt(colors=True, exception=e).error(