1 parent
65cc742211
commit
d2a1206814
2 files changed
+46
-13
No files matched your search
+14
-12
@@ -38,30 +38,32 @@ def do_p2_im_message_receive_v1(data: P2ImMessageReceiveV1) -> None:
|
||||
content = data.event.message.content
|
||||
content = json.loads(content)
|
||||
if message_type == "post":
|
||||
content = content.get("content", [])
|
||||
|
||||
for item in chain.from_iterable(content):
|
||||
for item in chain.from_iterable(data):
|
||||
if item.get("tag") == "text":
|
||||
message_content += item["text"]
|
||||
break
|
||||
elif item.get("tag") == "img":
|
||||
|
||||
if item.get("tag") == "img":
|
||||
images.append(item["image_key"])
|
||||
break
|
||||
|
||||
if message_type == "text":
|
||||
message_content = content["text"]
|
||||
message_content = content["text"].replace("@_user_1", "").strip()
|
||||
|
||||
record["问题概述"] = message_content
|
||||
record["创建人"] = data.event.sender.sender_id.open_id
|
||||
receive_open_id = data.event.sender.sender_id.open_id
|
||||
message_id = data.event.message.message_id
|
||||
user_id = data.event.sender.sender_id.user_id
|
||||
# add_record(record)
|
||||
content = {"text": "反馈的问题已经记录到多维表格, 稍后有小伙伴跟进"}
|
||||
|
||||
if images:
|
||||
record["附件"] = [{"file_token": image} for image in images]
|
||||
|
||||
add_record(record)
|
||||
|
||||
# content = {"text": "反馈的问题已经记录到多维表格, 稍后有小伙伴跟进"}
|
||||
# send_message(receive_id, content)
|
||||
content = (
|
||||
f'{{"text": "反馈的问题已经记录到多维表格, 稍后有小伙伴跟进"}}'
|
||||
)
|
||||
|
||||
# 回复群组的消息
|
||||
content = f'{{"text": "反馈的问题已经记录到多维表格, 稍后有小伙伴跟进"}}'
|
||||
send_group_message(message_id, content)
|
||||
|
||||
|
||||
|
||||
+32
-1
@@ -1 +1,32 @@
|
||||
import os
|
||||
from itertools import chain
|
||||
|
||||
|
||||
message_content = ""
|
||||
images = []
|
||||
data = [
|
||||
[
|
||||
{
|
||||
"height": 756,
|
||||
"image_key": "img_v3_0277_2c2fbab4-8b13-4a6a-a273-e0d1d47b4ecg",
|
||||
"tag": "img",
|
||||
"width": 529,
|
||||
}
|
||||
],
|
||||
[
|
||||
{"style": [], "tag": "text", "text": "11111111"},
|
||||
{"style": [], "tag": "at", "user_id": "@_user_1", "user_name": "官方应用指令"},
|
||||
{"style": [], "tag": "text", "text": ""},
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
for item in chain.from_iterable(data):
|
||||
if item.get("tag") == "text":
|
||||
message_content += item["text"]
|
||||
|
||||
if item.get("tag") == "img":
|
||||
images.append(item["image_key"])
|
||||
|
||||
|
||||
print(message_content)
|
||||
print(images)
|
||||
Reference in new issue
Block a user