1 parent
72753038d2
commit
2eb9fb36ea
2 files changed
+30
No files matched your search
@@ -20,6 +20,10 @@ def process_message_callback(
|
|||||||
# 如果 @机器人 不等于"记录问题", 什么都不做
|
# 如果 @机器人 不等于"记录问题", 什么都不做
|
||||||
# 如果 @机器人 等于"记录问题", 获取当前的话题, 从话题中提取问题发起人的所有消息和图片, 记录到多维表格中
|
# 如果 @机器人 等于"记录问题", 获取当前的话题, 从话题中提取问题发起人的所有消息和图片, 记录到多维表格中
|
||||||
|
|
||||||
|
if message_type == "text" and message_content != "记录问题":
|
||||||
|
message_content = content["text"].replace("@_user_1", "").strip()
|
||||||
|
lark.logger.info(f"message_content: {message_content}")
|
||||||
|
|
||||||
|
|
||||||
client = lark.Client.builder().app_id(app_id).app_secret(app_secret).build()
|
client = lark.Client.builder().app_id(app_id).app_secret(app_secret).build()
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from lark_oapi.api.docx.v1 import *
|
|||||||
import lark_oapi as lark
|
import lark_oapi as lark
|
||||||
from lark_oapi.api.contact.v3 import *
|
from lark_oapi.api.contact.v3 import *
|
||||||
from lark_oapi.api.wiki.v2 import *
|
from lark_oapi.api.wiki.v2 import *
|
||||||
|
from lark_oapi.api.im.v1 import *
|
||||||
|
|
||||||
|
|
||||||
def search_department(client):
|
def search_department(client):
|
||||||
@@ -282,6 +283,31 @@ def create_doc_block(
|
|||||||
lark.logger.info(lark.JSON.marshal(response.data, indent=4))
|
lark.logger.info(lark.JSON.marshal(response.data, indent=4))
|
||||||
|
|
||||||
|
|
||||||
|
def get_messages(client, container_id_type="", container_id="", page_size=50):
|
||||||
|
# 构造请求对象
|
||||||
|
request: ListMessageRequest = (
|
||||||
|
ListMessageRequest.builder()
|
||||||
|
.container_id_type(container_id_type)
|
||||||
|
.container_id(container_id)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
|
||||||
|
# 发起请求
|
||||||
|
response: ListMessageResponse = client.im.v1.message.list(request)
|
||||||
|
|
||||||
|
# 处理失败返回
|
||||||
|
if not response.success():
|
||||||
|
lark.logger.error(
|
||||||
|
f"client.im.v1.message.list failed, code: {response.code}, msg: {response.msg}, log_id: {response.get_log_id()}"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
# 处理业务结果
|
||||||
|
lark.logger.info(lark.JSON.marshal(response.data, indent=4))
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user