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
def at(user_id: str, user_name: str) -> "MessageSegment":
return MessageSegment("at", {
"user_id": user_id,
"user_name": user_name
})
def at(user_id: str) -> "MessageSegment":
return MessageSegment("at", {"user_id": user_id})
#发送消息
@staticmethod
@ -199,9 +196,12 @@ class MessageSerializer:
else:
if last_segment_type == "image":
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
return "post", json.dumps(msg)
return "post", json.dumps({"zh_cn": {**msg}})
else:
return self.message[0].type, json.dumps(self.message[0].data)