juzibot / donut-tester

40 stars 4 forks source link

Image `message.forward(room)` results in a thumb image message being forwarded (very low quality). #22

Open huan opened 4 years ago

huan commented 4 years ago

Reproduce steps:

  1. A user forward an image message to the bot
  2. the bot get an image message instance from the on(message, ...) event
  3. bot call message.forward(room), which the room is a Room instance.
  4. the image message was forwarded to the room, however, it was the very low-quality image instead of the full-size image.

Expected

The full-size image should be forwarded.

su-chang commented 4 years ago

I think we should use Image class to get artwork firstly, and then forward this one.

Class Image will work for these two methods:

Now it seem that it could work for toFileBox() only?

huan commented 4 years ago

The message.forward() is using the puppet.messageForward() to forward a message by massageId, which is implemented by the Puppet:

https://github.com/wechaty/wechaty/blob/f3a18c04e4414df28a1928c04c462dae14d40e83/src/user/message.ts#L903-L918

And in our Puppet, the messageForward() will call this.messageFile(messageId), which is an abstract method implemented in our PuppetDonut.

https://github.com/wechaty/wechaty-puppet/blob/41628eb83ed07d1692362c568158df9061f35c0a/src/puppet.ts#L1040-L1057

So we need to look at the messageFile() in PuppetDonut and make sure it will return the HD image to fix this issue.

su-chang commented 4 years ago

Related commit: https://github.com/juzibot/wechaty-puppet-donut/commit/2b1baa11846e3b1b47f363222bd2f77008e099fe

After upgrade donut for Friday Bot and Oss Chat, let's keep watching on this issue for one week.

huan commented 4 years ago

It's great to know that you have fixed this problem!

The best practice of fixing bugs is to link to the related issue with the source code commit message because it will help other developers getting to know which bug has been fixed. Please always refer to the issue number in the commit message (if there's any), thanks!