Giter VIP home page Giter VIP logo

Comments (5)

padlocal avatar padlocal commented on May 14, 2024

Can you provide your test case code?

15:59:50 WARN [PuppetPadlocal] stop() is called on a OFF puppet. await ready(off) and return.
15:59:50 VERB StateSwitch <PuppetPadlocal> ready(off, false)
15:59:50 SILL StateSwitch <PuppetPadlocal> ready(off, false) resolved.

-> 15:59:50 VERB Contact ready() this.wechaty.puppet.contactPayload(undefined) exception: no id

15:59:50 ERR Config ###########################

I am not sure why contactPayload will be called after logout.

from puppet-padlocal.

su-chang avatar su-chang commented on May 14, 2024

Test Case

bot.logout()

I think maybe you miss params payload for logout event.

Wechaty process logout event

case 'logout':
  puppet.on('logout', async payload => {
    const contact = this.ContactSelf.load(payload.contactId) // undefined
    await contact.ready()
    this.emit('logout', contact, payload.data)
  })
  break

from puppet-padlocal.

padlocal avatar padlocal commented on May 14, 2024

Still can not reproduce this issue. logout is handled as following in PadLocal Puppet:

public async logout(): Promise<void> {
    if (!this.id) {
      throw new Error("logout before login?");
    }

    await this._client!.api.logout();

    this.emit("logout", { contactId: this.id, data: "logout by self" });

    await this.stop();
}
this._client.on("kickout", async (_detail: KickOutEvent) => {
    this.emit("logout", { contactId: this.id!, data: JSON.stringify(_detail) });

    await this.stop();
});

I think the parameters are well supplied.

from puppet-padlocal.

su-chang avatar su-chang commented on May 14, 2024

Do you listen on logout event in wechaty ?

bot.on('logout', (user, reason) => {
  console.log(`==========logout success==========`);
  if (reason) {
    console.log(`reason : ${reason}`);
  }
})

from puppet-padlocal.

padlocal avatar padlocal commented on May 14, 2024

fixed in [email protected]

from puppet-padlocal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.