From 855c656585620a1ce626af3818ed569810a9da99 Mon Sep 17 00:00:00 2001 From: moemoli Date: Sun, 22 Feb 2026 14:30:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Daiohttp=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=BF=87=E6=96=B0=E5=AF=BC=E8=87=B4qq-botpy=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qqofficial/qqofficial_message_event.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py index a90ca7ebae..f5ab5ad883 100644 --- a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py +++ b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py @@ -25,6 +25,25 @@ from astrbot.core.utils.tencent_record_helper import wav_to_tencent_silk +def _patch_qq_botpy_formdata() -> None: + """Patch qq-botpy for aiohttp>=3.12 compatibility. + + qq-botpy 1.2.1 defines botpy.http._FormData._gen_form_data() and expects + aiohttp.FormData to have a private flag named _is_processed, which is no + longer present in newer aiohttp versions. + """ + + try: + from botpy.http import _FormData # type: ignore + + if not hasattr(_FormData, "_is_processed"): + setattr(_FormData, "_is_processed", False) + except Exception: + logger.debug("[QQOfficial] Skip botpy FormData patch.") + + +_patch_qq_botpy_formdata() + class QQOfficialMessageEvent(AstrMessageEvent): MARKDOWN_NOT_ALLOWED_ERROR = "不允许发送原生 markdown"