diff --git a/bot/core/plugin_manager.py b/bot/core/plugin_manager.py index c3a14cc..f7b0779 100644 --- a/bot/core/plugin_manager.py +++ b/bot/core/plugin_manager.py @@ -100,11 +100,7 @@ def module_handlers( for handler, group in handlers: if isinstance(handler, Handler) and isinstance(group, int): - group = ( - 0 - if (group < 0 and group_offset != 0) - else (group + group_offset) - ) + group = max(group + group_offset, 0) yield (handler, group) def get_handlers( @@ -159,7 +155,7 @@ def get_plugin_status(self, plugin: str) -> bool: with Session(Settings.engine) as session: enabled = session.execute( select(PluginDatabase.enabled).where( - PluginDatabase.name.is_(plugin) + PluginDatabase.name == plugin ) ).scalar() return bool(enabled) @@ -210,7 +206,7 @@ def custom_load_plugins( else: result[callback_name] = "Failed to load handler" logging.warning( - f"Failed to load {callback_name} handler, " + f"Failed to load {callback_name} handler " "because it is already loaded" ) @@ -239,7 +235,7 @@ def unload_plugins( result[callback_name] = "Failed to unload handler" logging.warning( f"Failed to unload {callback_name} handler, " - "it is not loaded already." + "it is not loaded." ) return result