Wechaty: How to get all the friends(Contact)'s list?

Created on 14 Sep 2018  路  3Comments  路  Source: wechaty/wechaty

As the title said, I want to get the list of all the friends of my account. I have tried using the Contact.findAll as below:
const contactList = await Wechaty.instance().Contact.findAll()

But only get a few friends' contacts.

How can I do? Or any limit from Wechat Official?

question

Most helpful comment

Not only check ready(),but you also need to check contact is friend() and official().

All 3 comments

Wechaty need some time to get all contactList ready. If it doesn't ready, it just can read all from cache.

You can try the following code when using padchat:

  .on('ready', async () => {
    // contact and room load ready
  })

Not only check ready(),but you also need to check contact is friend() and official().

Thanks, both of you.
Issue fixed and closed.

Was this page helpful?
0 / 5 - 0 ratings