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
779 stars 344 forks source link

Sample code not working for WhatsApp in Gitpot #191

Open YipZong opened 2 years ago

YipZong commented 2 years ago

1. Versions

2. Describe the bug

Give a clear and concise description of what the bug is.

3. To Reproduce

Following the guide here https://wechaty.js.org/docs/quick-start/running-on-gitpod/, trying to see what the bot can do in WhatsApp.

Steps to reproduce the behavior: 1.After generated QR for Wechat.

  1. Quit the running code in terminal using ctrl C
  2. run the command given below for using whatsapp. npm run start:whatsapp:web
  3. Error occurs

4. Expected behavior

QR code generated for whatsapp

5. Actual behavior

error

6. Full Output Logs

Set env WECHATY_LOG=silly in order to set log level to silly, then we can get the full log (If you dosen't set log env, log level is info as default, we cannot get the full log)

We need full log instead of log screenshot or log fragments!

Runtime error? ```shell $ WECHATY_LOG=silly node yourbot.js Question: Paste your FULL(DO NOT ONLY PROVIDE FRAGMENTS) log messages Answer: gitpod /workspace/wechaty-getting-started $ npm run start:whatsapp:web > wechaty-getting-started@0.11.9 start:whatsapp:web /workspace/wechaty-getting-started > cross-env WECHATY_LOG=verbose WECHATY_PUPPET=wechaty-puppet-whatsapp npm start > wechaty-getting-started@0.11.9 start /workspace/wechaty-getting-started > cross-env NODE_OPTIONS='--unhandled-rejections=strict' ts-node examples/ding-dong-bot.ts 10:01:15 INFO Config registering process.on("unhandledRejection") for development/debug 10:01:15 VERB Config constructor() 10:01:16 VERB Wechaty constructor() 10:01:16 VERB StateSwitch constructor(Wechaty, "{"log":{"enableTimestamp":true,"logLevel":4,"prefixFilter":{}}}") 10:01:16 VERB StateSwitch constructor(WechatyReady, "{"log":{"enableTimestamp":true,"logLevel":4,"prefixFilter":{}}}") 10:01:16 VERB Wechaty on(scan, listener) registering... listenerCount: 0 10:01:16 VERB Wechaty on(login, listener) registering... listenerCount: 0 10:01:16 VERB Wechaty on(logout, listener) registering... listenerCount: 0 10:01:16 VERB Wechaty on(message, listener) registering... listenerCount: 0 10:01:16 VERB Wechaty (ding-dong-bot) start() v0.63.7 is starting... 10:01:16 VERB Wechaty id: ckrj175rg00006e6087g774ha 10:01:16 VERB StateSwitch off(true) <- (true) 10:01:16 VERB StateSwitch on(pending) <- (false) 10:01:16 VERB MemoryCard constructor("ding-dong-bot") 10:01:16 VERB MemoryCard getStorage() for storage type: N/A 10:01:16 VERB getStorage name: ding-dong-bot, options: {"type":"file"} 10:01:16 VERB StorageFile constructor(ding-dong-bot, ...) 10:01:16 VERB StorageBackend constructor(ding-dong-bot, { type: file }) 10:01:16 VERB MemoryCard load() from storage: StorageFile 10:01:16 VERB StorageFile load() from /workspace/wechaty-getting-started/ding-dong-bot.memory-card.json 10:01:16 VERB Wechaty initPuppet() 10:01:16 VERB MemoryCard multiplex(puppet) 10:01:16 VERB MemoryCard static multiplex(MemoryCard, puppet) 10:01:16 VERB MemoryCard constructor({"name":"ding-dong-bot","multiplex":{"name":"puppet","parent":{"options":{"name":"ding-dong-bot"},"name":"ding-dong-bot","payload":{"\rpuppet\nPUPPET_WECHAT":[{"name":"MM_WX_SOUND_STATE","value":"1","domain":"wx.qq.com","path":"/","expires":-1,"size":18,"httpOnly":false,"secure":false,"session":true,"sameParty":false},{"name":"MM_WX_NOTIFY_STATE","value":"1","domain":"wx.qq.com","path":"/","expires":-1,"size":19,"httpOnly":false,"secure":false,"session":true,"sameParty":false},{"name":"mm_lang","value":"en","domain":".wx.qq.com","path":"/","expires":1627248916,"size":9,"httpOnly":false,"secure":true,"session":false,"sameParty":false}]},"multiplexNameList":[],"storage":{"name":"ding-dong-bot","options":{"type":"file"},"absFileName":"/workspace/wechaty-getting-started/ding-dong-bot.memory-card.json"}}}}) 10:01:16 VERB PuppetManager resolve({puppet: wechaty-puppet-whatsapp, puppetOptions: undefined}) 10:01:16 VERB PuppetManager resolveName(wechaty-puppet-whatsapp) 10:01:16 VERB PuppetManager checkModule(wechaty-puppet-whatsapp) /workspace/wechaty-getting-started/node_modules/node-webpmux/webp.js:441 #convertToExtended() { ^ SyntaxError: Unexpected token '(' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/whatsapp-web.js/src/util/Util.js:8:14) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/whatsapp-web.js/src/Client.js:8:14) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/whatsapp-web.js/index.js:6:13) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/wechaty-puppet-whatsapp/src/whatsapp.ts:4:1) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/wechaty-puppet-whatsapp/src/puppet-whatsapp.ts:52:1) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/workspace/wechaty-getting-started/node_modules/wechaty-puppet-whatsapp/src/mod.ts:2:1) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at /workspace/wechaty-getting-started/node_modules/wechaty/src/puppet-manager.ts:136:26 at Function.resolveName (/workspace/wechaty-getting-started/node_modules/wechaty/src/puppet-manager.ts:136:26) at Function.resolve (/workspace/wechaty-getting-started/node_modules/wechaty/src/puppet-manager.ts:88:24) at Wechaty.initPuppet (/workspace/wechaty-getting-started/node_modules/wechaty/src/wechaty.ts:400:28) at Wechaty.start (/workspace/wechaty-getting-started/node_modules/wechaty/src/wechaty.ts:724:7) 10:01:16 ERR Wechaty start() exception: Unexpected token '(' 10:01:16 ERR StarterBot SyntaxError: Unexpected token '(' gitpod /workspace/wechaty-getting-started $

7. Additional context

Add any other context about the problem here.

[bug]