wechaty / puppet-official-account

Wechaty Puppet for WeChat Official Account
https://wechaty.js.org/2020/11/06/wechaty-puppet-oa-released-en/
Apache License 2.0
16 stars 7 forks source link

Receive and send audio messages #21

Closed zhangfand closed 3 years ago

zhangfand commented 3 years ago

Fixes #19

The change adds support to OA puppet to receive and send audio files from / to Wechat, and add another example that "echo" text or audio messages.

The implementation is largely constructed per the detailed instructions in #19 (❤️ ) . There are a few catches:

  1. Have to make messageSend public and use it in the example instead of using messageSendFile. The main reason is mime package can not infer MIME type of amr file extension.
  2. How Wechat /get/media API handles audio file is not well documented. From experiments, it seems to always return the audio file. I've documented the assumed format in the code.
CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

zhangfand commented 3 years ago

Replied to questions in the code review.

wj-Mcat commented 3 years ago

Kindly ping @zhangfand

zhangfand commented 3 years ago

The newest mime package adds extentions mapping for audio/amr, which causes initialization failure in file-box (see failed test log).

huan/file-box#53 should fix the issue. Once that is merged, I can upgrade dependency version as part of the PR.

huan commented 3 years ago

Dove. Thank you very much for keeping the modules update!

huan commented 3 years ago

Thank you very much for your contribution!

You are welcome to join Wechaty Contributor Program

1. Join Wechaty Organization

You've invited Zhangfan to Wechaty! They'll be receiving an email shortly. They can also visit https://github.com/wechaty to accept the invitation.

I have invited you to join our Wechaty GitHub Organization, please accept it by following the above message.

2. Update Your Wechaty Contributor Profile

  1. Please open Contributor Hall of Fame and add yourself to the end of the list, so that other contributors will know you better!
  2. Please add yourself to our Website Contributors by creating a PR and refer to this PR link as well.

3. Join The Contributor Only WeChat Room

We also have a WeChat room for contributors only which can discuss Wechaty at a deeper level, you are welcome to join and if you are interested.

Please add @lijiarui wechat: _ruirui0914 and send her this pr link. She will invite you into Wechaty Contributor Room

Cheers!