accept friendship Args: None Examples: >>> await friendship.accept() Returns: None
(self)
| 165 | return contact |
| 166 | |
| 167 | async def accept(self) -> None: |
| 168 | """ |
| 169 | accept friendship |
| 170 | Args: |
| 171 | None |
| 172 | Examples: |
| 173 | >>> await friendship.accept() |
| 174 | Returns: |
| 175 | None |
| 176 | """ |
| 177 | log.info('accept friendship, friendship_id: <%s>', self.friendship_id) |
| 178 | if self.type() != FriendshipType.FRIENDSHIP_TYPE_RECEIVE: |
| 179 | raise WechatyOperationError( |
| 180 | 'accept() need type to be FriendshipType.' |
| 181 | 'FRIENDSHIP_TYPE_RECEIVE, but it got a " + FriendshipType : ' |
| 182 | '<{0}>'.format(self.type().name)) |
| 183 | |
| 184 | log.info('friendship accept to %s', self.payload.contact_id) |
| 185 | await self.puppet.friendship_accept(friendship_id=self.friendship_id) |
| 186 | contact = self.contact() |
| 187 | |
| 188 | # reset contact data |
| 189 | try: |
| 190 | # TODO -> some other logical code |
| 191 | await contact.ready() |
| 192 | # pylint:disable=W0703 |
| 193 | except Exception as e: |
| 194 | log.info( |
| 195 | "can't reload contact data %s", |
| 196 | str(e.args)) |
| 197 | |
| 198 | def hello(self) -> str: |
| 199 | """ |
nothing calls this directly
no test coverage detected