Get Share Card of the Message Extract the Contact Card from the Message, and encapsulate it into Contact class Examples: >>> msg.to_contact() Returns: Contact: contact
(self)
| 657 | return self.wechaty.Image.create(self.message_id) |
| 658 | |
| 659 | async def to_contact(self) -> Contact: |
| 660 | """ |
| 661 | Get Share Card of the Message |
| 662 | Extract the Contact Card from the Message, and encapsulate it into |
| 663 | Contact class |
| 664 | Examples: |
| 665 | >>> msg.to_contact() |
| 666 | Returns: |
| 667 | Contact: contact |
| 668 | """ |
| 669 | log.info('Message to Contact') |
| 670 | if self.type() != MessageType.MESSAGE_TYPE_CONTACT: |
| 671 | raise WechatyOperationError( |
| 672 | 'current message type: %s, not contact type' |
| 673 | % self.type() |
| 674 | ) |
| 675 | |
| 676 | contact_id = await self.puppet.message_contact(self.message_id) |
| 677 | |
| 678 | contact = self.wechaty.Contact.load(contact_id) |
| 679 | await contact.ready() |
| 680 | return contact |
| 681 | |
| 682 | async def to_url_link(self) -> UrlLink: |
| 683 | """ |
nothing calls this directly
no test coverage detected