mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 17:58:26 +08:00
⚡ remove optional param
This commit is contained in:
parent
d2ae2e2982
commit
730186cfd4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user