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

[enhancement] Add pdf, docx etc support to MediaMessage(now only picture is supported) #538

Closed
kungfu-software opened this Issue May 23, 2017 · 8 comments

Comments

Projects
None yet
5 participants
@kungfu-software

kungfu-software commented May 23, 2017

Please help to resolve the issue.
I am actually relay in two chatrooms. The share pdf file wont work.

  • ROM1 somebody send a pdf file:
    screen shot 2017-05-23 at 6 09 33 pm

  • ROM2 file didnt receive. In the log i find the follow error:
    screen shot 2017-05-23 at 6 09 47 pm

Thanks

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia May 23, 2017

Member

Need More Information

Sorry, you did not follow the ISSUE Template, and there's not enough information about your problem.

In order to help us to find the problem out, you should provide all the detail information about the issue. Please make sure you are following the ISSUE Template, answer all the question, and the more important: provide the steps to reproduce the problem.

cc @mukaiu

Member

zixia commented May 23, 2017

Need More Information

Sorry, you did not follow the ISSUE Template, and there's not enough information about your problem.

In order to help us to find the problem out, you should provide all the detail information about the issue. Please make sure you are following the ISSUE Template, answer all the question, and the more important: provide the steps to reproduce the problem.

cc @mukaiu

@kungfu-software

This comment has been minimized.

Show comment
Hide comment
@kungfu-software

kungfu-software May 23, 2017

Will do tomorrow.

kungfu-software commented May 23, 2017

Will do tomorrow.

@jinliming2

This comment has been minimized.

Show comment
Hide comment
@jinliming2

jinliming2 May 31, 2017

我也遇到这个问题了,尝试发送图片,可以正常发送,但是发送pptx等文件就会显示发送的是一个undefined文件,0字节,代码:

/**
 * 发送文件
 * @param {Sayable} to
 * @param {string}  filename
 * @param {Stream}  stream
 * @return {void}
 */
const sendFile = (to, filename, stream) => {
  const savePath = path.join('static', CONFIG.tempPath, filename);
  mkdirp(savePath.substr(0, savePath.lastIndexOf('/')), async err => {
    if (err) {
      return;
    }
    try {
      const fileStream = fs.createWriteStream(savePath);
      fileStream.on('close', async () => {
        await to.say(new MediaMessage(savePath));
        fs.unlinkSync(savePath);
      });
      stream.pipe(fileStream);
    } catch (e) {
      logger.error(`Save file Error: ${e}\n${e.stack}`);
    }
  });
};

里面的stream是一个http下载的文件流。
尝试改filename为英文也没用。

jinliming2 commented May 31, 2017

我也遇到这个问题了,尝试发送图片,可以正常发送,但是发送pptx等文件就会显示发送的是一个undefined文件,0字节,代码:

/**
 * 发送文件
 * @param {Sayable} to
 * @param {string}  filename
 * @param {Stream}  stream
 * @return {void}
 */
const sendFile = (to, filename, stream) => {
  const savePath = path.join('static', CONFIG.tempPath, filename);
  mkdirp(savePath.substr(0, savePath.lastIndexOf('/')), async err => {
    if (err) {
      return;
    }
    try {
      const fileStream = fs.createWriteStream(savePath);
      fileStream.on('close', async () => {
        await to.say(new MediaMessage(savePath));
        fs.unlinkSync(savePath);
      });
      stream.pipe(fileStream);
    } catch (e) {
      logger.error(`Save file Error: ${e}\n${e.stack}`);
    }
  });
};

里面的stream是一个http下载的文件流。
尝试改filename为英文也没用。

@mukaiu

This comment has been minimized.

Show comment
Hide comment
@mukaiu

mukaiu May 31, 2017

Contributor

@jinliming2 pptx is not supported. Late support.

Contributor

mukaiu commented May 31, 2017

@jinliming2 pptx is not supported. Late support.

@jinliming2

This comment has been minimized.

Show comment
Hide comment
@jinliming2

jinliming2 May 31, 2017

现在是只支持图片吗?
因为我试了一下,只有图片能正常发送,其他的比如txt也会失败。
但是web微信上手动发送是可以的。

jinliming2 commented May 31, 2017

现在是只支持图片吗?
因为我试了一下,只有图片能正常发送,其他的比如txt也会失败。
但是web微信上手动发送是可以的。

@zixia zixia added the enhancement label May 31, 2017

@zixia zixia changed the title from [enhancement] Cant send a pdf, docx etc to the room. to [enhancement] Add pdf, docx etc support to MediaMessage(now only picture is supported) May 31, 2017

@lijiarui

This comment has been minimized.

Show comment
Hide comment
@lijiarui

lijiarui Aug 5, 2017

Member

Hi, @kungfu-software Can you send pdf now?

Member

lijiarui commented Aug 5, 2017

Hi, @kungfu-software Can you send pdf now?

@lijiarui

This comment has been minimized.

Show comment
Hide comment
@lijiarui

lijiarui Aug 5, 2017

Member

Cannot send pdf too, It can send pic successfully but not pdf file.
get the following sending result:
image

log as follows:

TaskList: #TALK #3 #SUCCEED #interval: 3 #taskLog: broadcast file
21:02:29 SILL Message constructor() SN:6
21:02:29 VERB Room say(5步获得AWS的6万云服务代金券.pdf, )
TALK Task Done
21:02:29 VERB PuppetWebBridge getBaseRequest()
21:02:29 VERB PuppetWebBridge proxyWechaty(getBaseRequest, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBridge getPassticket()
21:02:29 VERB PuppetWebBridge proxyWechaty(getPassticket, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBridge getUploadMediaUrl()
21:02:29 VERB PuppetWebBridge proxyWechaty(getUploadMediaUrl, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBrowserCookie read()
21:02:29 SILL PuppetWebBrowserCookie read() webwx_data_ticket,MM_WX_SOUND_STATE,webwx_auth_ticket,MM_WX_NOTIFY_STATE,mm_lang,wxloadtime,wxpluginkey,pgv_si,wxsid,wxuin,webwxuvid,pgv_pvi
21:02:29 VERB PuppetWebBrowser hostname()
21:02:29 SILL PuppetWebBrowser Browser.execute("return document.domain")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBrowser hostname() got qq.com
21:02:29 VERB PuppetWeb self()
21:02:31 SILL PuppetWebEvent onServerDing(heartbeat@browser)
21:02:31 SILL PuppetWebWatchdog onFeed: 60000, HEARTBEAT[heartbeat@browser]
21:02:31 SILL StateSwitch Puppet:target() is live
21:02:31 SILL StateSwitch Puppet:inprocess() is false
21:02:31 SILL PuppetWebWatchdog clearWatchDogTimer() [45] seconds left
21:02:31 SILL PuppetWebWatchdog setWatchDogTimer(60000, HEARTBEAT:[heartbeat@browser])
21:02:31 SILL PuppetWebWatchdog monitorScan(HEARTBEAT)
21:02:31 SILL PuppetWebWatchdog autoSaveSession()
21:02:31 SILL PuppetWebWatchdog memoryCheck() free: 29 MB, require: 4 MB
21:02:31 SILL PuppetWeb send() destination: @@688884a466d382ba5040e2c0bfbe7fa327ac813f4edb6169b2620431f8a385ee, mediaId: @crypt_351c728f_7f1c3d10846338c49d6439fbd8905cd9e6f2b2af3b04e4e4d5ab428c45bdc809ee7c083f0c5581866c6160b38618077469013b833539b6fb6df8342bf10281537534ec64a4e84e630902eb0702007606)
21:02:31 VERB PuppetWebBridge proxyWechaty(sendMedia, @@688884a466d382ba5040e2c0bfbe7fa327ac813f4edb6169b2620431f8a385ee, @crypt_351c728f_7f1c3d10846338c49d6439fbd8905cd9e6f2b2af3b04e4e4d5ab428c45bdc809ee7c083f0c5581866c6160b38618077469013b833539b6fb6df8342bf10281537534ec64a4e84e630902eb0702007606, 49)
21:02:31 SILL PuppetWebBridge execute()
21:02:31 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:31 SILL StateSwitch Browser:target() is open
21:02:31 SILL StateSwitch Browser:current() is open
21:02:31 SILL PuppetWebBridge execute()
21:02:31 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:31 SILL StateSwitch Browser:target() is open
21:02:31 SILL StateSwitch Browser:current() is open
Member

lijiarui commented Aug 5, 2017

Cannot send pdf too, It can send pic successfully but not pdf file.
get the following sending result:
image

log as follows:

TaskList: #TALK #3 #SUCCEED #interval: 3 #taskLog: broadcast file
21:02:29 SILL Message constructor() SN:6
21:02:29 VERB Room say(5步获得AWS的6万云服务代金券.pdf, )
TALK Task Done
21:02:29 VERB PuppetWebBridge getBaseRequest()
21:02:29 VERB PuppetWebBridge proxyWechaty(getBaseRequest, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBridge getPassticket()
21:02:29 VERB PuppetWebBridge proxyWechaty(getPassticket, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBridge getUploadMediaUrl()
21:02:29 VERB PuppetWebBridge proxyWechaty(getUploadMediaUrl, )
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBridge execute()
21:02:29 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 VERB PuppetWebBrowserCookie read()
21:02:29 SILL PuppetWebBrowserCookie read() webwx_data_ticket,MM_WX_SOUND_STATE,webwx_auth_ticket,MM_WX_NOTIFY_STATE,mm_lang,wxloadtime,wxpluginkey,pgv_si,wxsid,wxuin,webwxuvid,pgv_pvi
21:02:29 VERB PuppetWebBrowser hostname()
21:02:29 SILL PuppetWebBrowser Browser.execute("return document.domain")
21:02:29 SILL StateSwitch Browser:target() is open
21:02:29 SILL StateSwitch Browser:current() is open
21:02:29 SILL PuppetWebBrowser hostname() got qq.com
21:02:29 VERB PuppetWeb self()
21:02:31 SILL PuppetWebEvent onServerDing(heartbeat@browser)
21:02:31 SILL PuppetWebWatchdog onFeed: 60000, HEARTBEAT[heartbeat@browser]
21:02:31 SILL StateSwitch Puppet:target() is live
21:02:31 SILL StateSwitch Puppet:inprocess() is false
21:02:31 SILL PuppetWebWatchdog clearWatchDogTimer() [45] seconds left
21:02:31 SILL PuppetWebWatchdog setWatchDogTimer(60000, HEARTBEAT:[heartbeat@browser])
21:02:31 SILL PuppetWebWatchdog monitorScan(HEARTBEAT)
21:02:31 SILL PuppetWebWatchdog autoSaveSession()
21:02:31 SILL PuppetWebWatchdog memoryCheck() free: 29 MB, require: 4 MB
21:02:31 SILL PuppetWeb send() destination: @@688884a466d382ba5040e2c0bfbe7fa327ac813f4edb6169b2620431f8a385ee, mediaId: @crypt_351c728f_7f1c3d10846338c49d6439fbd8905cd9e6f2b2af3b04e4e4d5ab428c45bdc809ee7c083f0c5581866c6160b38618077469013b833539b6fb6df8342bf10281537534ec64a4e84e630902eb0702007606)
21:02:31 VERB PuppetWebBridge proxyWechaty(sendMedia, @@688884a466d382ba5040e2c0bfbe7fa327ac813f4edb6169b2620431f8a385ee, @crypt_351c728f_7f1c3d10846338c49d6439fbd8905cd9e6f2b2af3b04e4e4d5ab428c45bdc809ee7c083f0c5581866c6160b38618077469013b833539b6fb6df8342bf10281537534ec64a4e84e630902eb0702007606, 49)
21:02:31 SILL PuppetWebBridge execute()
21:02:31 SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
21:02:31 SILL StateSwitch Browser:target() is open
21:02:31 SILL StateSwitch Browser:current() is open
21:02:31 SILL PuppetWebBridge execute()
21:02:31 SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
21:02:31 SILL StateSwitch Browser:target() is open
21:02:31 SILL StateSwitch Browser:current() is open
@lijiarui

This comment has been minimized.

Show comment
Hide comment
@lijiarui

lijiarui Aug 10, 2017

Member

fix, see #710

Member

lijiarui commented Aug 10, 2017

fix, see #710

@lijiarui lijiarui closed this Aug 10, 2017

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