format string for message, which keep consistant with wechaty/wechaty refer to : https://github.com/wechaty/wechaty/blob/master/src/user/message.ts#L195
(self)
| 94 | return self.payload.type |
| 95 | |
| 96 | def __str__(self) -> str: |
| 97 | """ |
| 98 | format string for message, which keep consistant with wechaty/wechaty |
| 99 | refer to : https://github.com/wechaty/wechaty/blob/master/src/user/message.ts#L195 |
| 100 | """ |
| 101 | if not self.is_ready(): |
| 102 | return f'Message <{self.message_id}> is not ready' |
| 103 | |
| 104 | message_list = [ |
| 105 | 'Message', |
| 106 | f'#{self.message_type().name.lower()}', |
| 107 | # talker can't be None |
| 108 | f'[🗣 {self.talker()}', |
| 109 | ] |
| 110 | if self.room(): |
| 111 | message_list.append(f'@👥 {self.room()}]') |
| 112 | |
| 113 | if self.message_type() == MessageType.MESSAGE_TYPE_TEXT: |
| 114 | message_list.append(f'\t{self.text()[:70]}') |
| 115 | |
| 116 | return ''.join(message_list) |
| 117 | |
| 118 | async def say(self, msg: Union[str, Contact, FileBox, UrlLink, MiniProgram], |
| 119 | mention_ids: Optional[List[str]] = None) -> Optional[Message]: |
nothing calls this directly
no test coverage detected