Get contact string representation.
(self)
| 293 | raise WechatyPayloadError('can"t load contact payload') |
| 294 | |
| 295 | def __str__(self) -> str: |
| 296 | """ |
| 297 | Get contact string representation. |
| 298 | """ |
| 299 | if not self.is_ready() or not self.payload: |
| 300 | return 'Contact <{}>'.format(self.contact_id) |
| 301 | |
| 302 | if self.payload.alias.strip() != '': |
| 303 | identity = self.payload.alias |
| 304 | elif self.payload.name.strip() != '': |
| 305 | identity = self.payload.name |
| 306 | elif self.contact_id.strip() != '': |
| 307 | identity = self.contact_id |
| 308 | else: |
| 309 | identity = 'loading ...' |
| 310 | return 'Contact <%s> <%s>' % (self.contact_id, identity) |
| 311 | |
| 312 | async def say(self, message: Union[str, Message, FileBox, Contact, UrlLink, MiniProgram] |
| 313 | ) -> Optional[Message]: |