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

Method to_recalled

src/wechaty/user/message.py:349–380  ·  view source on GitHub ↗

Get the recalled message Args: None Examples: >>> msg.to_recalled() Returns: Message: the recalled message

(self)

Source from the content-addressed store, hash-verified

347 return ''
348
349 async def to_recalled(self) -> Message:
350 """
351 Get the recalled message
352
353 Args:
354 None
355 Examples:
356 >>> msg.to_recalled()
357 Returns:
358 Message: the recalled message
359 """
360 if self.message_type() != MessageType.MESSAGE_TYPE_RECALLED:
361 raise WechatyOperationError(
362 'Can not call toRecalled() on message which is not'
363 ' recalled type.')
364
365 origin_message_id = self.text()
366 if origin_message_id is None:
367 raise WechatyPayloadError('Can not find recalled message')
368
369 log.info('get recall message <%s>', origin_message_id)
370 try:
371 message = self.wechaty.Message.load(origin_message_id)
372 await message.ready()
373 return message
374 except Exception as exception:
375 error_info = 'can"t load or ready message payload {}'.format(
376 str(exception.args)
377 )
378
379 log.error(error_info)
380 raise WechatyOperationError(error_info)
381
382 async def recall(self) -> bool:
383 """

Callers

nothing calls this directly

Calls 6

message_typeMethod · 0.95
textMethod · 0.95
WechatyPayloadErrorClass · 0.90
loadMethod · 0.45
readyMethod · 0.45

Tested by

no test coverage detected