コード例 #1
0
def _validate_caption(message: TMessage):
    if (message.animation or message.audio or message.document or message.photo
            or message.video or message.voice):
        message.caption = "" if not message.caption else message.caption
        caption = "" if not message.caption else message.caption_html_urled
        return caption, True
    else:
        return "", False
コード例 #2
0
def restore_text(msg: TGMessage, text: Optional[str]):
    """Return False if text was removed and message can't be reposted."""
    had_text = bool(msg.text)
    msg.text = text
    msg.caption = text
    return not (had_text and text is None)