Exemplo n.º 1
0
async def get_note_with_command(message, note_name):
    note_d = sql.get_note(message.chat.id, note_name)
    if not note_d:
        return
    note_message_id = note_d.d_message_id
    note_message = await message._client.get_messages(
        chat_id=TG_URI, message_ids=note_message_id, replies=0)
    n_m = message
    if message.reply_to_message:
        n_m = message.reply_to_message
    # 🥺 check two conditions 🤔🤔
    if note_message.media:
        _, file_id = get_file_id(note_message)
        caption = note_message.caption
        if caption:
            caption = caption.html
        await n_m.reply_cached_media(file_id=file_id,
                                     caption=caption,
                                     parse_mode="html",
                                     reply_markup=note_message.reply_markup)
    else:
        caption = note_message.text
        if caption:
            caption = caption.html
        disable_web_page_preview = True
        if "gra.ph" in caption or "youtu" in caption:
            disable_web_page_preview = False
        await n_m.reply_text(text=caption,
                             disable_web_page_preview=disable_web_page_preview,
                             parse_mode="html",
                             reply_markup=note_message.reply_markup)
Exemplo n.º 2
0
async def get_note_with_command(message, note_name):
    note_d = sql.get_note(message.chat.id, note_name)
    note_message_id = note_d.d_message_id
    note_message = await message._client.get_messages(
        chat_id=TG_URI,
        message_ids=note_message_id,
        replies=0
    )
    n_m = message
    if message.reply_to_message:
        n_m = message.reply_to_message
    # 🥺 check two conditions 🤔🤔
    if note_message.media:
        _, file_id = get_file_id(note_message)
        await n_m.reply_cached_media(
            file_id=file_id,
            caption=note_message.caption.html,
            parse_mode="html",
            reply_markup=note_message.reply_markup
        )
    else:
        disable_web_page_preview = True
        await n_m.reply_text(
            text=note_message.text.html,
            disable_web_page_preview=disable_web_page_preview,
            parse_mode="html",
            reply_markup=note_message.reply_markup
        )
Exemplo n.º 3
0
async def get_no_format_note(_, message):
    note_name = " ".join(message.command[1:])
    note_d = sql.get_note(message.chat.id, note_name)
    if not note_d:
        return
    note_message_id = note_d.d_message_id
    note_store_cid = str(TG_URI)[4:]
    await message.reply_text(
        f"https://t.me/c/{note_store_cid}/{note_message_id}")