Skip to content

Commit

Permalink
🐛 serialize should check message length
Browse files Browse the repository at this point in the history
Fix #87
  • Loading branch information
StarHeartHunt committed Jan 14, 2024
1 parent 7e02569 commit c250195
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nonebot/adapters/feishu/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,10 @@ def serialize(self) -> Tuple[str, str]:
combined.update(seg.data)

return "post", json.dumps(combined, ensure_ascii=False)
else:
elif len(self) == 1:
return self[0].type, json.dumps(self[0].data, ensure_ascii=False)
else:
raise ValueError("Cannot serialize empty message")

@staticmethod
def deserialize(
Expand Down

0 comments on commit c250195

Please sign in to comment.