🐛 修复使用help后重启会使已设为隐藏的命令重新展示的问题

This commit is contained in:
CMHopeSunshine 2023-01-07 18:30:25 +08:00
parent 7d08988347
commit 49608fd689
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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