Get message mentioned contactList. Args: None Examples: >>> msg.mention_list() Returns: List[Contact]: the contact list mentioned in the message
(self)
| 432 | return talker.contact_id == login_user.contact_id |
| 433 | |
| 434 | async def mention_list(self) -> List[Contact]: |
| 435 | """ |
| 436 | Get message mentioned contactList. |
| 437 | |
| 438 | Args: |
| 439 | None |
| 440 | Examples: |
| 441 | >>> msg.mention_list() |
| 442 | Returns: |
| 443 | List[Contact]: the contact list mentioned in the message |
| 444 | """ |
| 445 | log.info('Message mention_list') |
| 446 | room = self.room() |
| 447 | if self.type() != MessageType.MESSAGE_TYPE_TEXT or room is None: |
| 448 | return [] |
| 449 | |
| 450 | # Use mention list if mention list is available |
| 451 | # otherwise, process the message and get the mention list |
| 452 | |
| 453 | if self.payload is not None and self.payload.mention_ids is not None: |
| 454 | async def id_to_contact(contact_id: str) -> Contact: |
| 455 | contact = self.wechaty.Contact.load(contact_id) |
| 456 | await contact.ready() |
| 457 | return contact |
| 458 | |
| 459 | # TODO -> change to python async best practice |
| 460 | contacts = [ |
| 461 | await id_to_contact(contact_id) |
| 462 | for contact_id in self.payload.mention_ids] |
| 463 | return contacts |
| 464 | |
| 465 | # TODO -> have to check that mention_id is not in room situation |
| 466 | return [] |
| 467 | |
| 468 | async def mention_text(self) -> str: |
| 469 | """ |
no test coverage detected