ItChat-UOS icon indicating copy to clipboard operation
ItChat-UOS copied to clipboard

有发送语音的功能吗

Open ChaseXLiu opened this issue 1 year ago • 4 comments

可以发送微信语音吗

ChaseXLiu avatar Jun 20 '24 09:06 ChaseXLiu

不可以,没有这个接口,网页端也无法发送语音

CodeSnailss avatar Aug 19 '24 08:08 CodeSnailss

那能接受语音信息吗?

jinde98 avatar Sep 24 '24 13:09 jinde98

那能接受语音信息吗?

可以呀,用@itchat.msg_register(RECORDING)

@itchat.msg_register(RECORDING)
def download_audio(msg):
    # 检查并创建文件夹(如果不存在)
    if not os.path.exists(chat_audio_directory):
        os.makedirs(chat_audio_directory)
        print(f"文件夹 {chat_audio_directory} 不存在,已创建。")
    file_path = os.path.join(chat_audio_directory, msg.fileName)
    try:
        # 保存语音消息到本地
        msg.download(f"{file_path}")
        print(f"收到语音消息,已保存为 {file_path}")
    except Exception as e:
        print(e)

CodeSnailss avatar Sep 24 '24 13:09 CodeSnailss

感谢

jinde98 avatar Sep 25 '24 00:09 jinde98