From 9b1ffb384b2879b08c49c3a7bc430f0fa9fe565a Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Mon, 5 Aug 2024 04:46:12 -0400 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96aiocqhttp=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=99=A8=E7=9A=84=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/platform/qq_aiocqhttp.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/model/platform/qq_aiocqhttp.py b/model/platform/qq_aiocqhttp.py index 4abdfa891..0788a5b2e 100644 --- a/model/platform/qq_aiocqhttp.py +++ b/model/platform/qq_aiocqhttp.py @@ -48,6 +48,14 @@ class AIOCQHTTP(Platform): abm.message = [] message_str = "" + if not isinstance(event.message, list): + err = f"aiocqhttp: 无法识别的消息类型: {str(event.message)},此条消息将被忽略。如果您在使用 go-cqhttp,请将其配置文件中的 message.post-format 更改为 array。" + logger.critical(err) + try: + self.bot.send(event, err) + except BaseException as e: + logger.error(f"回复消息失败: {e}") + return for m in event.message: t = m['type'] a = None @@ -75,14 +83,12 @@ class AIOCQHTTP(Platform): abm = self.convert_message(event) if abm: await self.handle_msg(abm) - # return {'reply': event.message} @self.bot.on_message('private') async def private(event: Event): abm = self.convert_message(event) if abm: await self.handle_msg(abm) - # return {'reply': event.message} bot = self.bot.run_task(host=self.host, port=int(self.port), shutdown_trigger=self.shutdown_trigger_placeholder)