Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有发送语音的功能吗 #33

Open
LightChaserLiu opened this issue Jun 20, 2024 · 4 comments
Open

有发送语音的功能吗 #33

LightChaserLiu opened this issue Jun 20, 2024 · 4 comments

Comments

@LightChaserLiu
Copy link

可以发送微信语音吗

@CodeSnailss
Copy link

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

@jinde98
Copy link

jinde98 commented Sep 24, 2024

那能接受语音信息吗?

@CodeSnailss
Copy link

CodeSnailss commented Sep 24, 2024

那能接受语音信息吗?

可以呀,用@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)

@jinde98
Copy link

jinde98 commented Sep 25, 2024

感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants