Extract the Image File from the Message, so that we can use different image sizes. Examples: >>> msg.to_image() Returns: Image: image
(self)
| 640 | return file_box |
| 641 | |
| 642 | def to_image(self) -> Image: |
| 643 | """ |
| 644 | Extract the Image File from the Message, so that we can use |
| 645 | different image sizes. |
| 646 | Examples: |
| 647 | >>> msg.to_image() |
| 648 | Returns: |
| 649 | Image: image |
| 650 | """ |
| 651 | log.info('Message to Image() for message %s', self.message_id) |
| 652 | if self.type() != MessageType.MESSAGE_TYPE_IMAGE: |
| 653 | raise WechatyOperationError( |
| 654 | 'current message type: %s, not image type' |
| 655 | % self.type() |
| 656 | ) |
| 657 | return self.wechaty.Image.create(self.message_id) |
| 658 | |
| 659 | async def to_contact(self) -> Contact: |
| 660 | """ |
no test coverage detected