remove optional param

This commit is contained in:
StarHeartHunt 2021-07-08 23:05:24 +08:00
parent d2ae2e2982
commit 730186cfd4

View File

@ -60,11 +60,8 @@ class MessageSegment(BaseMessageSegment["Message"]):
#接收消息 #接收消息
@staticmethod @staticmethod
def at(user_id: str, user_name: str) -> "MessageSegment": def at(user_id: str) -> "MessageSegment":
return MessageSegment("at", { return MessageSegment("at", {"user_id": user_id})
"user_id": user_id,
"user_name": user_name
})
#发送消息 #发送消息
@staticmethod @staticmethod
@ -199,9 +196,12 @@ class MessageSerializer:
else: else:
if last_segment_type == "image": if last_segment_type == "image":
msg["content"].append([]) msg["content"].append([])
msg["content"][-1].append({"tag": segment.type, **segment.data}) msg["content"][-1].append({
"tag": segment.type if segment.type != "image" else "img",
**segment.data
})
last_segment_type = segment.type last_segment_type = segment.type
return "post", json.dumps(msg) return "post", json.dumps({"zh_cn": {**msg}})
else: else:
return self.message[0].type, json.dumps(self.message[0].data) return self.message[0].type, json.dumps(self.message[0].data)