diff --git a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py index 85bb2fead..81deead13 100644 --- a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py +++ b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py @@ -107,7 +107,7 @@ class AiocqhttpAdapter(Platform): ) await super().send_by_session(session, message_chain) - async def convert_message(self, event: Event) -> AstrBotMessage: + async def convert_message(self, event: Event) -> AstrBotMessage | None: logger.debug(f"[aiocqhttp] RawMessage {event}") if event["post_type"] == "message": @@ -222,7 +222,7 @@ class AiocqhttpAdapter(Platform): err = f"aiocqhttp: 无法识别的消息类型: {event.message!s},此条消息将被忽略。如果您在使用 go-cqhttp,请将其配置文件中的 message.post-format 更改为 array。" logger.critical(err) try: - self.bot.send(event, err) + await self.bot.send(event, err) except BaseException as e: logger.error(f"回复消息失败: {e}") return None diff --git a/astrbot/core/platform/sources/discord/discord_platform_adapter.py b/astrbot/core/platform/sources/discord/discord_platform_adapter.py index 276d3dce5..2752f3a9b 100644 --- a/astrbot/core/platform/sources/discord/discord_platform_adapter.py +++ b/astrbot/core/platform/sources/discord/discord_platform_adapter.py @@ -90,7 +90,7 @@ class DiscordPlatformAdapter(Platform): ) message_obj.self_id = self.client_self_id message_obj.session_id = session.session_id - message_obj.message = message_chain + message_obj.message = message_chain.chain # 创建临时事件对象来发送消息 temp_event = DiscordPlatformEvent( diff --git a/astrbot/core/platform/sources/discord/discord_platform_event.py b/astrbot/core/platform/sources/discord/discord_platform_event.py index 06f921bc4..0c1778eeb 100644 --- a/astrbot/core/platform/sources/discord/discord_platform_event.py +++ b/astrbot/core/platform/sources/discord/discord_platform_event.py @@ -1,5 +1,6 @@ import asyncio import base64 +import binascii import sys from io import BytesIO from pathlib import Path @@ -183,7 +184,7 @@ class DiscordPlatformEvent(AstrMessageEvent): BytesIO(img_bytes), filename=filename or "image.png", ) - except (ValueError, TypeError, base64.binascii.Error): + except (ValueError, TypeError, binascii.Error): logger.debug( f"[Discord] 裸 Base64 解码失败,作为本地路径处理: {file_content}", ) diff --git a/astrbot/core/platform/sources/slack/slack_adapter.py b/astrbot/core/platform/sources/slack/slack_adapter.py index 6c74a4713..6bb5a505e 100644 --- a/astrbot/core/platform/sources/slack/slack_adapter.py +++ b/astrbot/core/platform/sources/slack/slack_adapter.py @@ -82,7 +82,7 @@ class SlackAdapter(Platform): session: MessageSesion, message_chain: MessageChain, ): - blocks, text = SlackMessageEvent._parse_slack_blocks( + blocks, text = await SlackMessageEvent._parse_slack_blocks( message_chain=message_chain, web_client=self.web_client, )