manually cherry-pick commit of imageurl to dev
parent
8bf1bd1517
commit
eaee8a45fb
|
|
@ -84,4 +84,17 @@ class CommandType(Enum):
|
|||
return self.value
|
||||
|
||||
|
||||
ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file", "forward"]
|
||||
ACCEPT_FORMAT = [
|
||||
"text",
|
||||
"image",
|
||||
"emoji",
|
||||
"reply",
|
||||
"voice",
|
||||
"command",
|
||||
"voiceurl",
|
||||
"music",
|
||||
"videourl",
|
||||
"file",
|
||||
"imageurl",
|
||||
"forward",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ class SendMessageHandleClass:
|
|||
elif seg.type == "file":
|
||||
file_path = seg.data
|
||||
new_payload = cls.build_payload(payload, cls.handle_file_message(file_path), False)
|
||||
elif seg.type == "imageurl":
|
||||
image_url = seg.data
|
||||
new_payload = cls.build_payload(payload, cls.handle_imageurl_message(image_url), False)
|
||||
elif seg.type == "forward" and not in_forward:
|
||||
forward_message_content: List[Dict] = seg.data
|
||||
new_payload: List[Dict] = [
|
||||
|
|
@ -186,3 +189,11 @@ class SendMessageHandleClass:
|
|||
"type": "file",
|
||||
"data": {"file": f"file://{file_path}"},
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def handle_imageurl_message(image_url: str) -> dict:
|
||||
"""处理图片链接消息"""
|
||||
return {
|
||||
"type": "image",
|
||||
"data": {"file": image_url},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue