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

A friend that appears in the buddy list, does not exist. #143

Open
qiqizjl opened this issue Jun 18, 2019 · 1 comment
Open

A friend that appears in the buddy list, does not exist. #143

qiqizjl opened this issue Jun 18, 2019 · 1 comment

Comments

@qiqizjl
Copy link
Contributor

qiqizjl commented Jun 18, 2019

重要:请不要删除模板自行填写,所有不按照模板填写的issue,我们将不会处理。

0. 发 Issue 指南

  1. 请运行下面的命令,看问题是否可以被解决:
rm -rf package-lock.json
rm -rf node_modules
npm install
  1. 请在 FAQ 清单 看是否已有解决办法。

  2. 请先在issue 中搜关键信息,确认你要发的内容和之前的issue 不重复。

1. 提供你的包版本信息

  • wechaty 版本:0.26.1
  • wechaty-puppet-padpro 版本: 0.3.7
  • node 版本: (运行 node --version 获取版本) 10.16.0
  • 你使用的操作系统: macOS

2. Bug 描述

Use the Contact.findAll() interface to get the buddy list. After filtering friend() and type, I found that some users are not my friends. But the display is my friend. I set him an alias. It will also give an error.

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

这一部分非常重要,如果你无法给出复现步骤,我们也很难提供相应的解决办法:

复现步骤中一定要给出复现代码
Use the Contact.findAll() interface to get the buddy list. After filtering friend() and type, I found that some users are not my friends. But the display is my friend. I set him an alias. It will also give an error.

    const user = await ctx.service.response.fmtUserList(await app.wechat.Contact.findAll());
  public async fmtUserList(userList: Contact[]): Promise<User[]> {
    const res = [] as User[];
    await userList.forEach(async data => {
      // 过滤非好友
      if (!data.friend()) {
        return;
      }
      // 过滤公众号
      if (data.type() !== ContactType.Personal) {
        return;
      }
      // 过滤系统级用户 暂时维护白名单List
      if (this.systemUser.indexOf(data.id) !== -1) {
        return;
      }
      res.push({
        name: data.name(),
        star: data.star() || false,
        alias: await data.alias() || '',
        id: data.id,
        wechat_id: data.weixin(),
        user_id: await this.service.user.getUserID(data),
      } as User);
    });
    return res;
  }
 public async getUserID(user: Contact): Promise<string> {
    let alias = await user.alias();
    if (alias == null) {
      alias = uuid.v4();
      await user.alias(alias);
    }
    return alias;
  }

4. 期待程序运行的结果

Do not return this user

5. 程序实际运行的结果

Return the user and set alias failed
image

6. 完整的日志信息:

通过WECHATY_LOG=silly设定环境变量,将设置log 等级为 silly,获取最详细的日志信息(默认log 等级为 info)
请提供完整的日志信息(不要只提供部分的日志截图,请复制粘贴日志内容!)
The log is a bit big, please download the zip file.
padpro.log.zip

7. 其他信息

有相关bug 的背景信息,可以在这里说明

[bug]

@xinbenlv
Copy link

xinbenlv commented Jul 4, 2019

我有同样的问题

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