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

Rooms left before are still on the list. #133

Open willin opened 2 years ago

willin commented 2 years ago
bot.on('ready', async () => {
  const rooms = await bot.Room.findAll();
  for (const room of rooms) {
    log.info('Room', room);
    const members = await room.memberAll();
    log.info('Members', members);
  }
});
image

there are 6 groups returned in Room.findAll, however, 4 of them are already disbanded.

How to delete them from the findAll result or how to get real rooms which exists?

suntong commented 2 years ago

Interesting, my result is exactly on the contrary -- I got way few rooms than I'm in, from the bot.Room.findAll() output.

I think what happened might be, it remembers and logs all the rooms it had received message before, since login.

Are you doing such ... Ah, no, you're doing it at bot.on('ready'. Hmm, bot on ready should be before on login, right?