Check if a message is mention self. Examples: >>> msg.mention_self() Returns: bool: True if message is mention self, else False
(self)
| 503 | return text |
| 504 | |
| 505 | async def mention_self(self) -> bool: |
| 506 | """ |
| 507 | Check if a message is mention self. |
| 508 | Examples: |
| 509 | >>> msg.mention_self() |
| 510 | Returns: |
| 511 | bool: True if message is mention self, else False |
| 512 | """ |
| 513 | user_self: ContactSelf = self.wechaty.user_self() |
| 514 | |
| 515 | # check and ready for message payload |
| 516 | await self.ready() |
| 517 | |
| 518 | # check by mention_ids not mention_list |
| 519 | if self.payload is None or self.payload.mention_ids is None: |
| 520 | return False |
| 521 | return user_self.contact_id in self.payload.mention_ids |
| 522 | |
| 523 | async def ready(self) -> None: |
| 524 | """ |