wechaty / puppet-whatsapp

Wechaty Puppet for Whatsapp
https://npmjs.com/package/wechaty-puppet-whatsapp
Apache License 2.0
24 stars 17 forks source link

Can not receive message from bot self in other WhatsApp client. #355

Closed su-chang closed 2 years ago

su-chang commented 2 years ago

We can not receive message event for which send by bot self from other WhatsApp client. But we can receive message-create event.

So just need remove this condition: message.to === this.getBotId()

if (message.id.fromMe && message.to === this.getBotId()) {
      const messageId = message.id.id
      const cacheManager = await this.manager.getCacheManager()
      await cacheManager.setMessageRawPayload(messageId, message)
      this.emit('message', { messageId })
}
if (message.id.fromMe) {
      const messageId = message.id.id
      const cacheManager = await this.manager.getCacheManager()
      await cacheManager.setMessageRawPayload(messageId, message)
      this.emit('message', { messageId })
}
su-chang commented 2 years ago

It will be resolved after puppet-whatsapp@1.19.1.