wechaty / puppet-whatsapp

Wechaty Puppet for Whatsapp
https://npmjs.com/package/wechaty-puppet-whatsapp
Apache License 2.0
24 stars 17 forks source link

Fix use local auth replace session #344

Closed su-chang closed 2 years ago

su-chang commented 2 years ago

Related issue: https://github.com/pedroslopez/whatsapp-web.js/pull/1257

huan commented 2 years ago

If you remove the MemoryCard support from a puppet, then you will not be able to restore sessions from the Wechaty framework in the future.

su-chang commented 2 years ago

If you remove the MemoryCard support from a puppet, then you will not be able to restore sessions from the Wechaty framework in the future.

I will think about how to use MemoryCard to store LocalAuth session.

For example, use MemoryCard store the LocalAuth clientId from Wechaty framework.

this.whatsAppClient = new WhatsApp({
  authStrategy: new LocalAuth({ clientId: 'default-client' }),
  ...
})
huan commented 2 years ago

Using MemoryCard with Wechaty/Puppet is quite easy and straightforward:

this.memory.set('clientId', clientId)
await this.memory.save()

Then it will be enough.

Using it:

const clientId = await this.memory.get('clientId')
su-chang commented 2 years ago

Thank you for your suggestion, and MemoryCard will be back later in this pr.

huan commented 2 years ago

Great to know MemoryCard will be back later in this pr, and you are welcome!

su-chang commented 2 years ago

@huan MemoryCard back now, and do you have some other suggestions for this pr?

huan commented 2 years ago

Great to see that, I have no more suggestions, thank you very much.