62
62
# pytype: disable=pyi-error
63
63
from .url_link import UrlLink
64
64
from .mini_program import MiniProgram
65
-
65
+
66
66
67
67
log = get_logger ('Contact' )
68
68
@@ -190,7 +190,7 @@ async def find(cls,
190
190
191
191
Args:
192
192
query: the query body to build filter
193
-
193
+
194
194
Examples:
195
195
>>> # 1. find contacts based query string, will match one of: contact_id, weixin, name and alias
196
196
>>> # what's more, contact_id and weixin will follow extract match, name and alias will follow fuzzy match
@@ -319,7 +319,7 @@ async def say(self, message: Union[str, Message, FileBox, Contact, UrlLink, Mini
319
319
320
320
Args:
321
321
message: the message object to be sended to contact
322
-
322
+
323
323
Examples:
324
324
>>> contact = Contact.load('contact-id')
325
325
>>> await contact.say('hello')
@@ -331,7 +331,7 @@ async def say(self, message: Union[str, Message, FileBox, Contact, UrlLink, Mini
331
331
>>> await contact.say(MiniProgram('username', 'appid'))
332
332
333
333
Returns:
334
- Message: if the message is send successfully, return the message object, otherwise return None
334
+ Message: if the message is send successfully, return the message object, otherwise return None
335
335
"""
336
336
if not message :
337
337
log .error ('can"t say nothing' )
@@ -360,7 +360,7 @@ async def say(self, message: Union[str, Message, FileBox, Contact, UrlLink, Mini
360
360
conversation_id = self .contact_id ,
361
361
file = message
362
362
)
363
-
363
+ return None
364
364
elif isinstance (message , UrlLink ):
365
365
# use this way to resolve circulation dependency import
366
366
msg_id = await self .puppet .message_send_url (
@@ -390,7 +390,7 @@ def name(self) -> str:
390
390
Examples:
391
391
>>> contact = Contact.load('contact-id')
392
392
>>> name: str = contact.name
393
-
393
+
394
394
Returns:
395
395
str: name of contact, if the payload is None, return empty string
396
396
"""
@@ -403,7 +403,7 @@ async def alias(self,
403
403
) -> Union [None , str ]:
404
404
"""
405
405
Get or set alias of contact.
406
-
406
+
407
407
If new_alias is given, it will set alias to new_alias,
408
408
otherwise return current alias
409
409
@@ -527,7 +527,7 @@ def star(self) -> Optional[bool]:
527
527
def gender (self ) -> ContactGender :
528
528
"""
529
529
Return the gender of contact.
530
-
530
+
531
531
Returns:
532
532
ContactGender: the object of contact gender
533
533
"""
@@ -571,7 +571,7 @@ async def avatar(self, file_box: Optional[FileBox] = None) -> FileBox:
571
571
Args:
572
572
file_box: If given, it will set it as new avatar,
573
573
else get the current avatar. Defaults to None.
574
-
574
+
575
575
Examples:
576
576
>>> contact = Contact.load('contact-id')
577
577
>>> avatar = contact.avatar()
@@ -627,7 +627,7 @@ def weixin(self) -> Optional[str]:
627
627
Examples:
628
628
>>> contact = Contact.load('contact-id')
629
629
>>> weixin = contact.weixin()
630
-
630
+
631
631
Returns:
632
632
identifier: the weixin union identifier of contact
633
633
"""
0 commit comments