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
774 stars 342 forks source link

"wechaty-puppet-padlocal" not working #225

Open eslizn opened 2 years ago

eslizn commented 2 years ago
$ npm run start                      

> wechaty-getting-started@1.0.1 start
> cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm" node examples/ding-dong-bot.ts

01:09:55 ERR StateSwitch on() is deprecated: use active() instead.
Error
    at StateSwitch.on (/Users/src/github.com/wechaty/getting-started/node_modules/state-switch/src/state-switch.ts:222:85)
    at PuppetPadlocal._startClient (/Users/src/github.com/wechaty/getting-started/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:145:20)
    at PuppetPadlocal.start (/Users/src/github.com/wechaty/getting-started/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:141:16)
    at WechatyImpl.onStart (file:///Users/src/github.com/wechaty/getting-started/node_modules/wechaty/src/wechaty.ts:790:23)
    at async WechatyImpl.start (file:///Users/src/github.com/wechaty/getting-started/node_modules/state-switch/src/service-ctl/service-ctl.ts:91:9)
01:09:55 ERR StateSwitch on() is deprecated: use active() instead.
Error
    at StateSwitch.on (/Users/src/github.com/wechaty/getting-started/node_modules/state-switch/src/state-switch.ts:222:85)
    at PuppetPadlocal._startClient (/Users/src/github.com/wechaty/getting-started/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:153:16)
    at PuppetPadlocal.start (/Users/src/github.com/wechaty/getting-started/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:141:16)
    at WechatyImpl.onStart (file:///Users/src/github.com/wechaty/getting-started/node_modules/wechaty/src/wechaty.ts:790:23)
    at async WechatyImpl.start (file:///Users/src/github.com/wechaty/getting-started/node_modules/state-switch/src/service-ctl/service-ctl.ts:91:9)
01:09:57 INFO 
      ============================================================
       Welcome to Wechaty PadLocal puppet!

       - wechaty-puppet-padlocal version: 1.2.8
       - padlocal-ts-client version: 0.4.1
      ============================================================

01:09:57 ERR StarterBot TypeError: Cannot read properties of undefined (reading 'Unknown')
huan commented 2 years ago

Yes, the Wechaty 1.0 has an upgraded Puppet API v1.0 with breaking changes (mostly the export/import path) which is not compatible with the old version of PadLocal puppet.

The solution would be:

  1. Using an older version of Wechaty to use PadLocal, such as wechaty@0.68
  2. Using an old version of Wechaty (such as wechaty@0.68) to provide a DIY wechaty token gateway, then you can use wechaty@1.0 with the wechaty-puppet-service puppet and the token
  3. Sending a PR to upgrade PadLocal, or waiting for others to upgrade the code to be compatible with Puppet API v1.0

Link to