get the talker of the message Args: None Examples: >>> message.talker() Raises: WechatyPayloadError: can't find the talker information from the payload Returns: Contact: the talker contact object
(self)
| 268 | return messages |
| 269 | |
| 270 | def talker(self) -> Contact: |
| 271 | """get the talker of the message |
| 272 | Args: |
| 273 | None |
| 274 | Examples: |
| 275 | >>> message.talker() |
| 276 | Raises: |
| 277 | WechatyPayloadError: can't find the talker information from the payload |
| 278 | Returns: |
| 279 | Contact: the talker contact object |
| 280 | """ |
| 281 | talker_id = self.payload.from_id |
| 282 | if talker_id is None: |
| 283 | raise WechatyPayloadError('message must be from Contact') |
| 284 | return self.wechaty.Contact.load(talker_id) |
| 285 | |
| 286 | def to(self) -> Optional[Contact]: |
| 287 | """get the receiver, which is the Contact type, of the message |