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

Support Message Type of Image/Video #4

Closed
ak5 opened this issue May 19, 2016 · 27 comments
Closed

Support Message Type of Image/Video #4

ak5 opened this issue May 19, 2016 · 27 comments

Comments

@ak5
Copy link

ak5 commented May 19, 2016

I couldn't find a way to grab images or other media - any way to do this?

Thanks for this it's quite cool even with just text!

Alex


Update by zixia

@huan
Copy link
Member

huan commented May 20, 2016

@ak5 thanks for like wechaty.

as you need media support and submit this issue, I'll put this feature as high priority. 💯

stay tuned.

@huan huan added this to the v0.1.0 milestone May 20, 2016
@huan huan self-assigned this May 20, 2016
@huan huan changed the title support for getting media Support Message Type of Image/Video May 24, 2016
@ak5
Copy link
Author

ak5 commented Jun 14, 2016

Hi,

Any progress on this?

@hexsum
Copy link

hexsum commented Jun 14, 2016

能说中文吗…

@huan
Copy link
Member

huan commented Jun 14, 2016

hmm... I'm working on stable issues those weeks to make wechaty run smoothly. will try to finger out how to get media for you tonight. :)

@huan
Copy link
Member

huan commented Jun 14, 2016

@sjdy521 我觉得咱们说中文不太合适。和你聊天应该用 Perl 文 :-]

@huan
Copy link
Member

huan commented Jun 14, 2016

@ak5 how do you think this implementation? video should be easy grabed use the same way.

@huan huan modified the milestones: v0.3.0, v0.1.0 Jul 4, 2016
@huan huan modified the milestones: v0.4, v0.3.0 Aug 30, 2016
@huan huan modified the milestones: v0.5, v0.4 Oct 9, 2016
@naishstar
Copy link

Hi @zixia bumping this request! Receiving images via message as well as plain text would be awesome! Any idea if you would have time to do this some time soon? The implementation you showed would be perfect.

@huan
Copy link
Member

huan commented Oct 24, 2016

@naishstar

thanks for bumping! I'm hoping to finish this issue on version 0.5, for supporting receive video/audio and send image/audio/video as well as plain text.

as your request, receiving images via message has already supported in the current code, which you can find at example/image-bot.ts, run by npm run ts-node example/image-bot.

you can have a try.

@huan
Copy link
Member

huan commented Nov 4, 2016

so there's only one issue left which belongs to the milestone v0.5...

it's you! 🔪

@huan
Copy link
Member

huan commented Nov 10, 2016

There's a media file demo bot in the example directory:

https://github.com/wechaty/wechaty/blob/master/example/media-file-bot.ts

huan added a commit that referenced this issue Nov 11, 2016
huan added a commit that referenced this issue Nov 11, 2016
…e https will only succeed on the very first request!
huan pushed a commit that referenced this issue Nov 26, 2016
trying to fix room.owner()
@tiaozi0912
Copy link

+1. It would be very nice to have this feature.

@huan
Copy link
Member

huan commented Dec 9, 2016

@tiaozi0912 Thanks for pump this up!

In order to support send files(image/video/motion gif/pdf/etc), what we need to do is:

  1. Get to know how to call webwxApp API_webwxuploadmedia , source code at here: link, we can study it from Wechat4U at here: link
  2. Expose a method, ie: uploadMediaAsync() for API_webwxuploadmedia in WechatyBro(wechaty-bro.js) around here: link
  3. add new methods for supporting uploadMediaAsync in bridge.ts & puppet-web.ts, examples can be found at here and there
  4. modify class MediaMessage in message-media.ts, to support add a media stream to message method, like MediaMessage.addMedia()(?)
  5. modify PuppetWeb.send() to support Message with media file.

The list above might not a full list, I'll add new thoughts to this post when I get them in my mind.

It will be great if you could kick it off, and I'll be very happy to follow you and make it works.

@huan huan added this to the v0.6 milestone Dec 21, 2016
@huan
Copy link
Member

huan commented Dec 23, 2016

Split this issue into sub-issues is better because this issue include many feature/functions.

In order to send sticker/image/attachment/video, we need to implement API_webwxuploadmedia first.

Then everything should be easy to implement. :)

@huan huan modified the milestones: v0.7, v0.6 Jan 2, 2017
@huan huan modified the milestones: v0.8, v0.7 Jan 11, 2017
@huan huan mentioned this issue Mar 4, 2017
@lbineau
Copy link

lbineau commented Mar 8, 2017

Any news for this issue? Wechaty is really convenient but messaging with only plain text, we miss a lot of wechat functionalities. In my opinion this feature is really a must have.

@huan
Copy link
Member

huan commented Mar 12, 2017

@lbineau Thanks for voting this up. :)

@ghost
Copy link

ghost commented Mar 21, 2017

Thanks @mukaiu's work, I can send Image-message right now.

@huan huan closed this as completed in 11760a5 Mar 30, 2017
@huan
Copy link
Member

huan commented Mar 30, 2017

Hi all, good news! The pull request to implement send attachment file from @lockon is just merged to the master branch! This feature will be available after Wechaty v0.7.58. Please submit an issue if you meet any problem or have any suggestions, Cheers!

@yumewang
Copy link

yumewang commented Apr 21, 2017

Can not support message which is .gif file?
Is someone here? Can you tell me why I can not send .gif?

I did like below:

    let mediaM = new MediaMessage(__dirname + '/test.gif');  
    room.say(mediaM)

but, when I checked this message at specified room, I found the message with 0KB&undefined (Just use type:APP, 49).
error
when I sent image(.png, .jpg), that's no any problems. I thought maybe asynchronous processing (Like .gif is not finished, there sent message already)?I have no idea of this.

If I do wrong or ignore something, please tell me.
Can you give me some helps to go through this problem?
Thank you very much!

@huan huan reopened this Apr 21, 2017
@mukaiu
Copy link
Contributor

mukaiu commented Apr 25, 2017

@yumewang Fixed,please test PR #438

@yumewang
Copy link

yumewang commented Apr 26, 2017

@mukaiu Thank you firstly.
I have just finished this test. It works totally.
But there is one issue: It keeps saying to self, when I got a message, and send a file(.gif).

multi-file-send
ps: I used /example/ding-dong-bot.ts to test directly.

Sorry for big pic, I could not resize this pic at Markdown.

@yumewang
Copy link

@mukaiu can we support to say voice(.mp3 or .amr). I thought this is not be done as you have just changed for saying .gif?

@d2cs
Copy link

d2cs commented Jun 8, 2017

if someone came here while looking for some guide on how to send images using wechaty,
here is what i have found working for me (npm wechaty no docker), no tscript:

const	{ Wechaty }				= require('wechaty')
const 	Room 					= require('wechaty').Room
const 	MediaMessage 			= require('wechaty').MediaMessage

// blablabla login etc

Wechaty.instance({ profile:'bot' })

Room.find({topic:"YourRoomTopic"}).then( room => { **room.say (new MediaMessage('FileName.jpg'))** })

if room is defined already, then simply the bold part of it and ofc you may read FileName.jpg from some var.

@huan
Copy link
Member

huan commented Jun 8, 2017

@d2cs Thanks for sharing.

I'd like to make a suggestion:

+ const	{ Wechaty, Room, MediaMessage } = require('wechaty')
- const	{ Wechaty }				= require('wechaty')
- const 	Room 					= require('wechaty').Room
- const 	MediaMessage 			= require('wechaty').MediaMessage

@binsee
Copy link

binsee commented Aug 8, 2017

Support for sending any type of file.

doc/pdf/ppt/mp3/mp4/gif/jpg... any type file.

see #714

@huan
Copy link
Member

huan commented Aug 10, 2017

Thanks, @binsee !

Finally, this issue seems could be closed in the near future, after 12 months... LOL.

@huan
Copy link
Member

huan commented Aug 18, 2017

  1. PR from @mukaiu was already landed, and
  2. PR from @binsee will be landed recently.

So I closed this issue for keep issue list clean.

Appreciate for the discussion about this feature!

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

No branches or pull requests