const { Wechaty } = require('wechaty')
const { PuppetMacpro } = require('wechaty-puppet-macpro')
const puppet = new PuppetMacpro({
token: 'puppet_macpro_111111111111111111'
})
bot = new Wechaty({
puppet,
})
let loginUserId = null
bot.on('scan', (qrcode, status) => {
console.log(`https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrcode)}`)
})
.on('login', user => {
loginUserId = user.id
})
.on('message', message => {
console.log(loginUserId, message.to().id)
// when other contact send message to this bot, the result is:
// xidian53565 wxid_rhlfugm72vft12
//
// actually, **xidian53565** is the bot's real weixin ID, and **wxid_rhlfugm72vft12**
// identical with the bot's id which got from padchat-sdk.
})
.start()