add download message image
continuous-integration/drone/push Build is passing

This commit is contained in:
jianxin committed 2024-01-17 17:58:04 +08:00
1 parent aa2b264cf6
commit 98f846d630
1 file changed
+6 -3
+6 -3
View File
@@ -66,17 +66,20 @@ def do_p2_im_message_receive_v1(data: P2ImMessageReceiveV1) -> None:
message_id = data.event.message.message_id
user_id = data.event.sender.sender_id.user_id
if images:
record["附件"] = [{"file_token": image} for image in images]
# 对 image_key 处理并并上传至多维表格
images_path = []
images_token = []
for image in images:
image_path = get_message_resource(client, message_id, image, "image", cache_dir)
print("下载文件成功:", image, image_path)
images_path.append(image_path)
file_token = upload_media(client, image_path, "bitable_image", bitable_token)
print("上传文件成功:", file_token)
images_token.append(file_token)
if images:
record["附件"] = [{"file_token": image} for image in images_token]
add_record(record)