提交 4ca3f33f 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix(contact) better warn message if weixin() can not get id from a contact

上级 64cfd228
......@@ -146,7 +146,15 @@ export class Contact implements Sayable {
* const weixin = contact.weixin()
* ```
*/
public weixin() { return this.obj && this.obj.weixin || null }
public weixin(): string | null {
const wxId = this.obj && this.obj.weixin || null
if (!wxId) {
log.info('Contact', `weixin() is not able to always work, it's limited by Tencent API`)
log.silly('Contact', 'weixin() If you want to track a contact between sessions, see FAQ at')
log.silly('Contact', 'https://github.com/Chatie/wechaty/wiki/FAQ#1-how-to-get-the-permanent-id-for-a-contact')
}
return wxId
}
/**
* Get the name from a contact
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册