From f7b694ac56de2ac04fa1319c27db895edd3ebf1a Mon Sep 17 00:00:00 2001 From: huiwen Date: Tue, 26 Dec 2023 14:30:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=AD=E9=9F=B3=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=B6=88=E6=81=AF=E5=92=8C=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E7=9A=84=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/dingtalk/dingtalk_message.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/channel/dingtalk/dingtalk_message.py b/channel/dingtalk/dingtalk_message.py index 57e1455..ef9dc96 100644 --- a/channel/dingtalk/dingtalk_message.py +++ b/channel/dingtalk/dingtalk_message.py @@ -15,7 +15,7 @@ class DingTalkMessage(ChatMessage): msg_type = event.message_type self.incoming_message =event self.sender_staff_id = event.sender_staff_id - + self.other_user_id = event.conversation_id self.create_time = event.create_at if event.conversation_type=="1": self.is_group = False @@ -27,7 +27,11 @@ class DingTalkMessage(ChatMessage): self.ctype = ContextType.TEXT self.content = event.text.content.strip() - + elif msg_type == "audio": + + # 钉钉支持直接识别语音,所以此处将直接提取文字,当文字处理 + self.content = event.extensions['content']['recognition'].strip() + self.ctype = ContextType.TEXT self.from_user_id = event.sender_id self.to_user_id = event.chatbot_user_id self.other_user_nickname = event.conversation_title