获取当前机器人账号全部联系人信息
bot.on('ready', async () => {
console.log("机器人准备完毕!!!")
let contactList = await bot.Contact.findAll()
for (let index = 0; index < contactList.length; index++) {
const contact = contactList[index];
if (contact.payload.name == '番茄土豆') {
console.log(contact)
}
}
})
Contact 对象属性
WechatifiedContactImpl {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
id: '@9c7f307a0233472ab92c0d3c8624fd0a2a8522a9d085f0b89a540d23ff76d862',
payload: {
address: '',
alias: '',
avatar: '/cgi-bin/mmwebwx-bin/webwxgeticon?seq=768678887&username=@9c7f307a0233472ab92c0d3c8624fd0a2a8522a9d085f0b89a540d23ff76d862&skey=@crypt_13d84e54_3b3f2c2d3fa4b54729339f73cdf121e6',
city: '',
friend: true,
gender: 0,
id: '@9c7f307a0233472ab92c0d3c8624fd0a2a8522a9d085f0b89a540d23ff76d862',
name: '番茄土豆',
phone: [],
province: '',
signature: '',
star: false,
weixin: '',
type: 1
},
[Symbol(kCapture)]: false
}
联系人接口