wechaty / matrix-appservice

Wechaty [Matrix] Application Services Bridge
https://matrix.org/docs/projects/bridge/matrix-appservice-wechaty
Apache License 2.0
131 stars 16 forks source link

Support image and file messages #86

Closed lprintf closed 3 years ago

lprintf commented 3 years ago

We support image and file messages by upload files to matrix mainly through the api. For image message, setting the file type option as image when upload file can ensure it show as image in elements.

lprintf commented 3 years ago

appservice-manager.sendMessage() is a method to deel with the wechaty messages from wechat(actually could be other apps). We use intent.uploadContent(ref the api) to upload image or file messages, and intent.sendMessage(ref the ture actions of matrix showed in element source code when we send though element.

matrix-handler.superEvent2Message is a method to deel with the messages from matrix. We use appserviceManager.mxcUrlToHttp to get the https urls of the source file, if the message is images or attachments, and convert its to fileboxs and send its to wechat.

huan commented 3 years ago

@545641826 The PR has been merged and I believe it will publish a new version of the NPM and Docker image soon.

Please link your future issues to our OSPP'21 project issue at https://github.com/wechaty/summer-of-wechaty/issues/59 so that we can see all changes in the OSPP main issue.

Could you please also add your changes to the History section in the README.md so that we can track the version changes?

Thank you very much.

lprintf commented 3 years ago

OK, I have finished the above requirements.