Merge pull request #54 from xuqian13/feat/imageurl

feat: 添加直接发送图片链接功能
pull/57/head
UnCLAS-Prommer 2025-08-25 00:35:55 +08:00 committed by GitHub
commit 4549f92fee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -84,4 +84,4 @@ class CommandType(Enum):
return self.value
ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file"]
ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file","imageurl"]

View File

@ -181,6 +181,9 @@ class SendHandler:
elif seg.type == "file":
file_path = seg.data
new_payload = self.build_payload(payload, self.handle_file_message(file_path), False)
elif seg.type == "imageurl":
image_url = seg.data
new_payload = self.build_payload(payload, self.handle_imageurl_message(image_url), False)
return new_payload
def build_payload(self, payload: list, addon: dict, is_reply: bool = False) -> list:
@ -270,6 +273,13 @@ class SendHandler:
"type": "file",
"data": {"file": f"file://{file_path}"},
}
def handle_imageurl_message(self, image_url: str) -> dict:
"""处理图片链接消息"""
return {
"type": "image",
"data": {"file": image_url},
}
def handle_ban_command(self, args: Dict[str, Any], group_info: GroupInfo) -> Tuple[str, Dict[str, Any]]:
"""处理封禁命令