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

Method __str__

src/wechaty/user/contact.py:295–310  ·  view source on GitHub ↗

Get contact string representation.

(self)

Source from the content-addressed store, hash-verified

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]:

Callers

nothing calls this directly

Calls 1

is_readyMethod · 0.80

Tested by

no test coverage detected