fix(discord-cross): 修复跨平台消息处理和附件下载问题
修复QQ群消息处理中的非群消息过滤问题 优化Discord附件下载逻辑,使用aiohttp替代requests 修复Redis订阅任务重复创建问题 调整消息格式化的embed字段处理逻辑
This commit is contained in:
@@ -55,6 +55,10 @@ async def handle_qq_group_message(event: GroupMessageEvent):
|
||||
if not config.ENABLE_CROSS_PLATFORM:
|
||||
return
|
||||
|
||||
# 忽略非群消息和 Discord 注入的消息
|
||||
if not hasattr(event, 'group_id') or hasattr(event, '_is_discord_message'):
|
||||
return
|
||||
|
||||
group_id = event.group_id
|
||||
mapped_channel = None
|
||||
for discord_channel_id, info in config.CROSS_PLATFORM_MAP.items():
|
||||
|
||||
@@ -327,13 +327,14 @@ async def format_qq_to_discord_content(
|
||||
"name": f"{qq_nickname}",
|
||||
"icon_url": f"https://q1.qlogo.cn/g?b=qq&nk={qq_user_id}&s=640"
|
||||
},
|
||||
"description": content if content else "",
|
||||
"timestamp": None,
|
||||
"footer": {
|
||||
"text": f"来自 QQ"
|
||||
}
|
||||
}
|
||||
|
||||
if content:
|
||||
embed["description"] = content
|
||||
|
||||
if attachments:
|
||||
image_urls = []
|
||||
voice_urls = []
|
||||
@@ -364,7 +365,10 @@ async def format_qq_to_discord_content(
|
||||
filtered_attachments.append(att)
|
||||
|
||||
attachments = filtered_attachments
|
||||
embed["description"] = content if content else ""
|
||||
if content:
|
||||
embed["description"] = content
|
||||
elif "description" not in embed:
|
||||
embed["description"] = ""
|
||||
|
||||
if image_urls:
|
||||
embed["image"] = {"url": image_urls[0]}
|
||||
|
||||
Reference in New Issue
Block a user