mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 20:01:04 +00:00
Fix(bot manager): _get_platform_id_for_group 是一个异步方法(async def),但在 main.py 中调用时忘记加 await (#54)
* fix(bot-manager): 正确处理实例获取 * fix(import); AiocqhttpAdapter 导入 * fix: 通过 meta 实现 aiocqhttp 判断 * fix(_get_platform_id_for_group): _get_platform_id_for_group 是一个异步方法(async def),但在 main.py 中调用时忘记加 await 了,导致它返回了一个协程对象而不是字符串 ID * fix(pre-commit)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import asyncio
|
||||
import weakref
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from astrbot.api import logger
|
||||
|
||||
|
||||
@@ -95,13 +96,11 @@ class AutoScheduler:
|
||||
)
|
||||
continue
|
||||
|
||||
# 如果所有适配器都尝试失败,记录警告并返回第一个
|
||||
logger.warning(
|
||||
f"⚠️ 无法确定群 {group_id} 属于哪个平台,使用第一个适配器"
|
||||
# 如果所有适配器都尝试失败,记录错误并返回 None
|
||||
logger.error(
|
||||
f"❌ 无法确定群 {group_id} 属于哪个平台 (已尝试: {list(self.bot_manager._bot_instances.keys())})"
|
||||
)
|
||||
first_platform = list(self.bot_manager._bot_instances.keys())[0]
|
||||
logger.warning(f"使用默认平台: {first_platform}")
|
||||
return first_platform
|
||||
return None
|
||||
|
||||
# 没有任何bot实例,返回None
|
||||
logger.error("❌ 没有注册的bot实例")
|
||||
|
||||
Reference in New Issue
Block a user