Impl download attachment

This commit is contained in:
Changhua 2023-11-21 21:05:29 +08:00
parent 4c13d86d41
commit 40eff8eab3
2 changed files with 70 additions and 49 deletions

View File

@ -580,6 +580,25 @@ class Wcf():
rsp = self._send_request(req)
return rsp.status
def download_attach(self, id: int, thumb: str, extra: str) -> str:
"""下载附件(图片、视频、文件)
Args:
id (int): 消息中 id
thumb (str): 消息中的 thumb
extra (str): 消息中的 extra
Returns:
str: 成功返回存储路径空字符串为失败原因见日志
"""
req = wcf_pb2.Request()
req.func = wcf_pb2.FUNC_DOWNLOAD_ATTACH # FUNC_DOWNLOAD_ATTACH
req.att.id = id
req.att.thumb = thumb
req.att.extra = extra
rsp = self._send_request(req)
return rsp.str
def decrypt_image(self, src: str, dst: str) -> bool:
"""解密图片:

File diff suppressed because one or more lines are too long