Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot.Contact.findAll()获取到的好友信息中未找到好友 #176

Open
scholar-wei opened this issue Jul 22, 2019 · 1 comment
Open

Comments

@scholar-wei
Copy link

1. 提供你的包版本信息

  • wechaty 版本:"^0.23"
  • wechaty-puppet-padpro 版本:"^0.2.1"
  • node 版本:"v10.15.3"
  • 你使用的操作系统:CentOS or Mac

2. Bug 描述

创建群聊,bot.Contact.findAll()获取到的好友信息中有些好友找不到,导致创建不了群

3. 复现的步骤 (或者解决的步骤)

相关代码如下:

// id为微信号
this.getFriend = async (id) =>{
    const allFriends = await this.bot.Contact.findAll();

     const info = _.find(allFriends,(o)=>{
        const wxId = await o.weixin();
        return o.payload.friend && (id === wxId || o.id === id);
    });
    console.log(info);
}

4. 期待程序运行的结果

期望能够打印出好友信息

5. 程序实际运行的结果

部分好友无法打印出好友信息,具体复现路径未知(好友数量500+)

[bug]

@windmemory
Copy link
Member

Could you please try with the function below?

this.getFriend = async (id) => {
  const contact = this.bot.Contact.load(id)
  await contact.sync()
  return contact
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants