瀏覽代碼

fix: delete same file twice

master
lanvent 1 年之前
父節點
當前提交
388058467c
共有 2 個檔案被更改,包括 6 行新增3 行删除
  1. +4
    -2
      channel/chat_channel.py
  2. +2
    -1
      channel/wechat/wechaty_channel.py

+ 4
- 2
channel/chat_channel.py 查看文件

@@ -144,9 +144,11 @@ class ChatChannel(Channel):
# 删除临时文件
try:
os.remove(file_path)
os.remove(wav_path)
if wav_path != file_path:
os.remove(wav_path)
except Exception as e:
logger.warning("[WX]delete temp file error: " + str(e))
pass
# logger.warning("[WX]delete temp file error: " + str(e))

if reply.type == ReplyType.TEXT:
new_context = self._compose_context(


+ 2
- 1
channel/wechat/wechaty_channel.py 查看文件

@@ -84,7 +84,8 @@ class WechatyChannel(ChatChannel):
asyncio.run_coroutine_threadsafe(receiver.say(msg),loop).result()
try:
os.remove(file_path)
os.remove(sil_file)
if sil_file != file_path:
os.remove(sil_file)
except Exception as e:
pass
logger.info('[WX] sendVoice={}, receiver={}'.format(reply.content, receiver))


Loading…
取消
儲存