From 333be39cb46c83bb69307f624ad3836fa62dbb75 Mon Sep 17 00:00:00 2001 From: Farzin Kazemzadeh Date: Tue, 28 Jul 2026 13:56:34 +0330 Subject: [PATCH 1/3] refactor(core): simplify handler group calculation Signed-off-by: Farzin Kazemzadeh --- bot/core/plugin_manager.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bot/core/plugin_manager.py b/bot/core/plugin_manager.py index c3a14cc..cb64ecb 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( From 5ea4198851d049ada3629455f04aeece706c21d8 Mon Sep 17 00:00:00 2001 From: Farzin Kazemzadeh Date: Tue, 28 Jul 2026 13:58:22 +0330 Subject: [PATCH 2/3] refactor(core): use equality for plugin name filter Signed-off-by: Farzin Kazemzadeh --- bot/core/plugin_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/core/plugin_manager.py b/bot/core/plugin_manager.py index cb64ecb..11e784a 100644 --- a/bot/core/plugin_manager.py +++ b/bot/core/plugin_manager.py @@ -155,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) From 8380474a727af8876f0522b079a8ee37ff023d50 Mon Sep 17 00:00:00 2001 From: Farzin Kazemzadeh Date: Tue, 28 Jul 2026 14:00:29 +0330 Subject: [PATCH 3/3] chore(core): improve warning messages Signed-off-by: Farzin Kazemzadeh --- bot/core/plugin_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/core/plugin_manager.py b/bot/core/plugin_manager.py index 11e784a..f7b0779 100644 --- a/bot/core/plugin_manager.py +++ b/bot/core/plugin_manager.py @@ -206,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" ) @@ -235,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