juzibot / wechaty-puppet-macpro

One puppet based on Mac WeChat for Wechaty.
Apache License 2.0
38 stars 10 forks source link

inconsistant botId obtained from login event and message event #2

Closed iyjian closed 5 years ago

iyjian commented 5 years ago

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()
su-chang commented 5 years ago
iyjian commented 5 years ago

seems fixed