manually cherry-pick commit of imageurl to dev

pull/59/head
UnCLAS-Prommer 2025-09-10 22:47:58 +08:00
parent 8bf1bd1517
commit eaee8a45fb
No known key found for this signature in database
2 changed files with 25 additions and 1 deletions

View File

@ -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",
]

View File

@ -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},
}