Skip to content

Commit

Permalink
添加语音发送消息和修复上下文的关联
Browse files Browse the repository at this point in the history
  • Loading branch information
huiwenTT committed Dec 26, 2023
1 parent d3ab8fb commit f7b694a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions channel/dingtalk/dingtalk_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, event: ChatbotMessage):
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
Expand All @@ -27,7 +27,11 @@ def __init__(self, event: ChatbotMessage):
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
Expand Down

0 comments on commit f7b694a

Please sign in to comment.