wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
642 stars 88 forks source link

Some deprecated functions need to be updated #114

Closed 0kuang closed 2 years ago

0kuang commented 2 years ago

https://github.com/padlocal/wechaty-puppet-padlocal/blob/a4b04b723fc4f75d08596a2952e08f4b5037983c/src/puppet-padlocal.ts#L145

StateSwitch on() is deprecated: use active() instead.

Similarly, replace off() with inactivate() .

huan commented 2 years ago

@0kuang It's great to know that you are following our latest version of Wechaty, and thank you very much for filing this issue to improve the Wechaty ecosystem.

With the latest puppet design, we can remove all the state management code from the implementation of the puppet-padlocal, and reuse the code from PuppetAbstract class, here's the related issue:

The suggested change will be:

  1. Rename start () to onStart ()
  2. Remove all this.state checkings and try {} catch code
  3. Do the same to the stop ()

See: https://github.com/wechaty/puppet-wechat/blob/e34c8a1a998e045814b3dff052f74385de7a464b/src/puppet-wechat.ts#L182-L197

0kuang commented 2 years ago

Thank you for your timely response. I'm looking forward to the new version v0.51.

huan commented 2 years ago

You are welcome.

I have talked with @padlocal this week and we hope the PadLocal can be adapted with the new v1.x API soon.

padlocal commented 2 years ago

Fixed on branch esm, will be publisehd in version 1.x soon,