MCPcopy
hub / github.com/wechaty/python-wechaty / to_image

Method to_image

src/wechaty/user/message.py:642–657  ·  view source on GitHub ↗

Extract the Image File from the Message, so that we can use different image sizes. Examples: >>> msg.to_image() Returns: Image: image

(self)

Source from the content-addressed store, hash-verified

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 """

Callers 1

on_messageMethod · 0.80

Calls 3

typeMethod · 0.95
createMethod · 0.45

Tested by

no test coverage detected