From 1869c0ae9d43202993cab7484ac399155ef6821d Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Wed, 12 Feb 2025 23:19:03 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BD=BF=E7=94=A8gather=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/help_help.py | 6 +++++- .../web_ui/api/tabs/dashboard/data_source.py | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/zhenxun/builtin_plugins/help_help.py b/zhenxun/builtin_plugins/help_help.py index fd57fdfc..c315bcd8 100644 --- a/zhenxun/builtin_plugins/help_help.py +++ b/zhenxun/builtin_plugins/help_help.py @@ -48,7 +48,11 @@ async def _(matcher: Matcher, message: UniMsg, session: EventSession): return if text := message.extract_plain_text().strip(): if plugin := await PluginInfo.get_or_none( - name=text, load_status=True, plugin_type=PluginType.NORMAL + name=text, + load_status=True, + plugin_type=PluginType.NORMAL, + block_type__isnull=True, + status=True, ): image = None if _path.exists(): diff --git a/zhenxun/builtin_plugins/web_ui/api/tabs/dashboard/data_source.py b/zhenxun/builtin_plugins/web_ui/api/tabs/dashboard/data_source.py index 25fe6758..6c312db3 100644 --- a/zhenxun/builtin_plugins/web_ui/api/tabs/dashboard/data_source.py +++ b/zhenxun/builtin_plugins/web_ui/api/tabs/dashboard/data_source.py @@ -1,3 +1,4 @@ +import asyncio from datetime import datetime, timedelta import time @@ -65,10 +66,12 @@ class ApiDataSource: self_id=bot.self_id, nickname=nickname, ava_url=ava_url, platform=platform ) try: - group_list, _ = await PlatformUtils.get_group_list(bot, True) - friend_list, _ = await PlatformUtils.get_friend_list(bot) - bot_info.group_count = len(group_list) - bot_info.friend_count = len(friend_list) + group, friend = await asyncio.gather( + PlatformUtils.get_group_list(bot, True), + PlatformUtils.get_friend_list(bot), + ) + bot_info.group_count = len(group[0]) + bot_info.friend_count = len(friend[0]) except Exception as e: logger.warning("获取bot好友/群组信息失败...", "WebUi", e=e) bot_info.group_count = 0