diff --git a/LittlePaimon/config/plugin/manage.py b/LittlePaimon/config/plugin/manage.py index 917f878..d5363bd 100644 --- a/LittlePaimon/config/plugin/manage.py +++ b/LittlePaimon/config/plugin/manage.py @@ -102,7 +102,7 @@ class PluginManager: :param session_id: 消息ID """ load_plugins = [p.name for p in nb_plugin.get_loaded_plugins()] - plugin_list = sorted(cls.plugins.values(), key=lambda x: x.priority).copy() + plugin_list = sorted(cls.plugins.values(), key=lambda x: x.priority) plugin_list = [p for p in plugin_list if p.show and p.module_name in load_plugins] for plugin in plugin_list: if await PluginDisable.filter(name=plugin.module_name, global_disable=True).exists(): @@ -117,7 +117,6 @@ class PluginManager: user_id=session_id).exists() if plugin.matchers: plugin.matchers.sort(key=lambda x: x.pm_priority) - plugin.matchers = [m for m in plugin.matchers if m.pm_show and m.pm_usage] return plugin_list @classmethod diff --git a/LittlePaimon/plugins/plugin_manager/draw_help.py b/LittlePaimon/plugins/plugin_manager/draw_help.py index cb7d0b9..0bd014f 100644 --- a/LittlePaimon/plugins/plugin_manager/draw_help.py +++ b/LittlePaimon/plugins/plugin_manager/draw_help.py @@ -54,7 +54,8 @@ async def draw_help(plugin_list: List[PluginInfo]): await img.text(plugin.name, 63, height_now + 5, fm.get('SourceHanSerifCN-Bold.otf', 30), 'white') height_now += plugin_line.height + 11 if plugin.matchers: - matcher_groups = [plugin.matchers[i:i + 3] for i in range(0, len(plugin.matchers), 3)] + matchers = [matcher for matcher in plugin.matchers if matcher.pm_show and matcher.pm_usage] + matcher_groups = [matchers[i:i + 3] for i in range(0, len(matchers), 3)] for matcher_group in matcher_groups: max_length = max(len(matcher.pm_description) if matcher.pm_description else 0 for matcher in matcher_group) max_height = math.ceil(max_length / 16) * 22 + 40