wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
798 stars 351 forks source link

Issue on sending url link to user #61

Closed csea007 closed 5 years ago

csea007 commented 6 years ago

I encountered issue on sending url link to user, here are my code and error log:

/local wechaty version: wechaty@0.23.10/

async function onMessage(msg) {
......

const LinkPayload = {
        description: '评级:'+body.a.others[0].distance.toString()+',来源:'+body.a.others[0].source,
        thumbnailUrl: 'http://www.haola.com/images/haola.png',
        title : body.a.others[0].title,
        url   : body.a.others[0].url
      }
      msg.say(LinkPayload)

----------------------------------------------------------
report error:
(node:32318) UnhandledPromiseRejectionWarning: Error: unknown msg: [object Object]
    at AnotherOriginalClass.<anonymous> (/root/node_modules/wechaty/dist/src/user/message.js:392:23)
    at Generator.next (<anonymous>)
    at /root/node_modules/wechaty/dist/src/user/message.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/root/node_modules/wechaty/dist/src/user/message.js:3:12)
    at AnotherOriginalClass.say (/root/node_modules/wechaty/dist/src/user/message.js:348:16)
    at Request._callback (/root/tuling.js:117:11)
    at Request.self.callback (/root/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at Request.<anonymous> (/root/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at IncomingMessage.<anonymous> (/root/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
    at IncomingMessage.EventEmitter.emit (domain.js:442:20)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:32318) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:32318) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Could you help me to check and give some guidance on how to fix this issue? Thanks in advance.

Thanks in advance, Jackie

csea007 commented 6 years ago

I got example at here: https://github.com/Chatie/wechaty-getting-started/pull/59/commits/1bcb6f8528ef6de608f7bdce7b44c6d34455887c

One more question, is the sending url event only supported by padchat? I got the another error report as below

(node:14724) UnhandledPromiseRejectionWarning: Error: Wechaty Puppet Unsupported API Error. Learn More At https://github.com/Chatie/wechaty-puppet/wiki/Compatibility
    at Object.throwUnsupportedError (/root/node_modules/wechaty-puppet/dist/src/throw-unsupported-error.js:4:11)
    at PuppetPuppeteer.<anonymous> (/root/node_modules/wechaty/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:294:30)
    at Generator.next (<anonymous>)
    at /root/node_modules/wechaty/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:25:71
    at new Promise (<anonymous>)
    at __awaiter (/root/node_modules/wechaty/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:21:12)
    at PuppetPuppeteer.messageSendUrl (/root/node_modules/wechaty/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:293:16)
    at AnotherOriginalClass.<anonymous> (/root/node_modules/wechaty/dist/src/user/message.js:386:35)
    at Generator.next (<anonymous>)
    at /root/node_modules/wechaty/dist/src/user/message.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/root/node_modules/wechaty/dist/src/user/message.js:3:12)
    at AnotherOriginalClass.say (/root/node_modules/wechaty/dist/src/user/message.js:348:16)
    at Request._callback (/root/tuling.js:117:11)
    at Request.self.callback (/root/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at Request.<anonymous> (/root/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at IncomingMessage.<anonymous> (/root/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
    at IncomingMessage.EventEmitter.emit (domain.js:442:20)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
huan commented 6 years ago

Yes, the sending url API is only supported by padchat currently.

huan commented 5 years ago

Learn more about all the puppet providers from https://github.com/Chatie/wechaty-puppet/wiki/Directory and know the differences between them at https://github.com/Chatie/wechaty-puppet/wiki/Compatibility