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

Method mention_self

src/wechaty/user/message.py:505–521  ·  view source on GitHub ↗

Check if a message is mention self. Examples: >>> msg.mention_self() Returns: bool: True if message is mention self, else False

(self)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 2

readyMethod · 0.95
user_selfMethod · 0.80

Tested by

no test coverage detected