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
6. 完整的日志信息:
通过WECHATY_LOG=silly设定环境变量,将设置log 等级为 silly,获取最详细的日志信息(默认log 等级为 info)
请提供完整的日志信息(不要只提供部分的日志截图,请复制粘贴日志内容!)
The log is a bit big, please download the zip file.
padpro.log.zip
0. 发 Issue 指南
请运行下面的命令,看问题是否可以被解决:
请在 FAQ 清单 看是否已有解决办法。
请先在issue 中搜关键信息,确认你要发的内容和之前的issue 不重复。
1. 提供你的包版本信息
node --version
获取版本) 10.16.02. Bug 描述
Use the
Contact.findAll()
interface to get the buddy list. After filteringfriend()
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 filteringfriend()
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.4. 期待程序运行的结果
Do not return this user
5. 程序实际运行的结果
Return the user and set alias failed![image](https://user-images.githubusercontent.com/7540584/59669125-3c361f00-91ec-11e9-8f59-380a4d38a958.png)
6. 完整的日志信息:
通过
WECHATY_LOG=silly
设定环境变量,将设置log 等级为 silly,获取最详细的日志信息(默认log 等级为 info) 请提供完整的日志信息(不要只提供部分的日志截图,请复制粘贴日志内容!) The log is a bit big, please download the zip file. padpro.log.zip7. 其他信息
有相关bug 的背景信息,可以在这里说明
[bug]