Skip to content

Commit

Permalink
🐛 temporary fix #78
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt committed Sep 23, 2023
1 parent 94cb83f commit fba3c50
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions nonebot/adapters/feishu/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,23 @@ def serialize(self) -> Tuple[str, str]:
if len(segments) > 1:
msg = {"title": "", "content": [[]]}
for segment in segments:
if segment == "image":
if segment.type == "image":
if last_segment_type != "image":
msg["content"].append([])
else:
if last_segment_type == "image":
msg["content"].append([])
msg["content"][-1].append(
{
"tag": segment.type if segment.type != "image" else "img",
**segment.data,
}
)

if segment.type != "post":
msg["content"][-1].append(
{
"tag": segment.type if segment.type != "image" else "img",
**segment.data,
}
)
else:
msg["title"] = segment.data["title"]
msg["content"].append(segment.data["content"][0])
last_segment_type = segment.type
return "post", json.dumps({"zh_cn": {**msg}})

Expand Down

0 comments on commit fba3c50

Please sign in to comment.