Support Message Type of Image/Video #4

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

Comments

Projects
None yet
@ak5

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

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia May 20, 2016

Member

@ak5 thanks for like wechaty.

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

stay tuned.

Member

zixia 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.

@zixia zixia added this to the v0.1.0 milestone May 20, 2016

@zixia zixia added the enhancement label May 20, 2016

@zixia zixia self-assigned this May 20, 2016

@zixia zixia changed the title from support for getting media to Support Message Type of Image/Video May 24, 2016

@ak5

This comment has been minimized.

Show comment
Hide comment
@ak5

ak5 Jun 14, 2016

Hi,

Any progress on this?

ak5 commented Jun 14, 2016

Hi,

Any progress on this?

@sjdy521

This comment has been minimized.

Show comment
Hide comment
@sjdy521

sjdy521 Jun 14, 2016

能说中文吗…

sjdy521 commented Jun 14, 2016

能说中文吗…

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 14, 2016

Member

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. :)

Member

zixia 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. :)

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 14, 2016

Member

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

Member

zixia commented Jun 14, 2016

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

zixia added a commit that referenced this issue Jun 14, 2016

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 14, 2016

Member

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

Member

zixia commented Jun 14, 2016

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

@zixia zixia modified the milestones: v0.3.0, v0.1.0 Jul 4, 2016

@zixia zixia modified the milestones: v0.4, v0.3.0 Aug 30, 2016

@zixia zixia modified the milestones: v0.5, v0.4 Oct 9, 2016

@naishstar

This comment has been minimized.

Show comment
Hide comment
@naishstar

naishstar Oct 23, 2016

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.

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.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Oct 24, 2016

Member

@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.

Member

zixia 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.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Nov 4, 2016

Member

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

it's you! 🔪

Member

zixia commented Nov 4, 2016

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

it's you! 🔪

zixia added a commit that referenced this issue Nov 9, 2016

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Nov 10, 2016

Member

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

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

Member

zixia 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

zixia added a commit that referenced this issue Nov 11, 2016

zixia added a commit that referenced this issue Nov 11, 2016

#4 use http protocol instead of https for download media file, becau…
…se https will only succeed on the very first request!

zixia pushed a commit that referenced this issue Nov 26, 2016

Merge pull request #4 from wechaty/master
trying to fix room.owner()
@tiaozi0912

This comment has been minimized.

Show comment
Hide comment
@tiaozi0912

tiaozi0912 Dec 9, 2016

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

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

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Dec 9, 2016

Member

@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.

Member

zixia 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.

@zixia zixia modified the milestones: v0.6, v0.5 Dec 21, 2016

@dcsan

This comment has been minimized.

Show comment
Hide comment
@dcsan

dcsan Dec 22, 2016

Should this be another ticket? Support for images, even without video would be a very huge improvement!

dcsan commented Dec 22, 2016

Should this be another ticket? Support for images, even without video would be a very huge improvement!

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Dec 23, 2016

Member

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. :)

Member

zixia 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. :)

@zixia zixia modified the milestones: v0.7, v0.6 Jan 2, 2017

@zixia zixia modified the milestones: v0.8, v0.7 Jan 11, 2017

@zixia zixia referenced this issue Mar 4, 2017

Closed

How to send image? #295

@lbineau

This comment has been minimized.

Show comment
Hide comment
@lbineau

lbineau 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.

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.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Mar 12, 2017

Member

@lbineau Thanks for voting this up. :)

Member

zixia commented Mar 12, 2017

@lbineau Thanks for voting this up. :)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 21, 2017

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

ghost commented Mar 21, 2017

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

@zixia zixia closed this in 11760a5 Mar 30, 2017

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Mar 30, 2017

Member

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!

Member

zixia 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

This comment has been minimized.

Show comment
Hide comment
@yumewang

yumewang 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!

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!

@zixia zixia reopened this Apr 21, 2017

@mukaiu

This comment has been minimized.

Show comment
Hide comment
@mukaiu

mukaiu Apr 25, 2017

Contributor

@yumewang Fixed,please test PR #438

Contributor

mukaiu commented Apr 25, 2017

@yumewang Fixed,please test PR #438

@yumewang

This comment has been minimized.

Show comment
Hide comment
@yumewang

yumewang 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 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

This comment has been minimized.

Show comment
Hide comment
@yumewang

yumewang Apr 26, 2017

@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?

@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

This comment has been minimized.

Show comment
Hide comment
@d2cs

d2cs 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.

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.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 8, 2017

Member

@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
Member

zixia 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

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Aug 8, 2017

Member

Support for sending any type of file.

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

see #714

Member

binsee commented Aug 8, 2017

Support for sending any type of file.

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

see #714

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Aug 10, 2017

Member

Thanks, @binsee !

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

Member

zixia commented Aug 10, 2017

Thanks, @binsee !

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

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Aug 18, 2017

Member
  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!

Member

zixia 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!

@zixia zixia closed this Aug 18, 2017

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