From ca25d0433f3ff727b54e457a292bdc4a79eedcab Mon Sep 17 00:00:00 2001 From: chenzhenkun Date: Thu, 14 Sep 2023 17:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/wework/wework_channel.py | 3 +++ channel/wework/wework_message.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/channel/wework/wework_channel.py b/channel/wework/wework_channel.py index b82935f..722cc3e 100644 --- a/channel/wework/wework_channel.py +++ b/channel/wework/wework_channel.py @@ -302,5 +302,8 @@ class WeworkChannel(ChatChannel): wework.send_video(receiver, video_path) logger.info("[WX] sendVideo, receiver={}".format(receiver)) elif reply.type == ReplyType.VOICE: + current_dir = os.getcwd() + voice_file = reply.content.split("/")[-1] + reply.content = os.path.join(current_dir, "tmp", voice_file) wework.send_file(receiver, reply.content) logger.info("[WX] sendFile={}, receiver={}".format(reply.content, receiver)) diff --git a/channel/wework/wework_message.py b/channel/wework/wework_message.py index bd08091..e9f1187 100644 --- a/channel/wework/wework_message.py +++ b/channel/wework/wework_message.py @@ -69,6 +69,12 @@ def c2c_download_and_convert(wework, message, file_name): wav_file = base_name + ".wav" pilk.silk_to_wav(save_path, wav_file, rate=24000) + # 删除SILK文件 + try: + os.remove(save_path) + except Exception as e: + pass + class WeworkMessage(ChatMessage): def __init__(self, wework_msg, wework, is_group=False):