1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to redirect to a specific message in a group on telegram?

Discussão em 'Python' iniciado por Stack, Setembro 28, 2024 às 15:12.

  1. Stack

    Stack Membro Participativo

    I'm coding a python code to retrieve message in all my private groups (there are like 500 message in each group/each hour). So it's impossible for me to read thoses and this is why I need a bot.

    I can connect with TelegramClient() so I can read every new message that is posted in my groups. Sometimes I want to get a fast access to one of theses messages (reference) so I also use telegram-bot with a token to send me a private message with a link to that message.

    The problem is: I cannot make any link to work.

    I tried this at first:

    message_link = f"https://t.me/c/{(chat_id)}/{message_id}"
    await bot.send_message(chat_id=your_chat_id, text=f"Price found: {current_number} in group '{chat_name}' at this link {message_link}.")


    here the problem is that this open up a browser (so it quit my telegram app) and it redirect on telegram.org

    so I tried this one:

    message_link = f"tg://resolve?domain={(chat_id)}&message_id={message_id}"
    await bot.send_message(chat_id=your_chat_id, text=f"Price found: {current_number} in group '{chat_name}' at this link {message_link}.")


    And this tell me "this user does not exist", i just want to get a fast access to a specific message in a group why does it speak about a user ?

    To help, this is the kind of value I get for chat_id and message_id:

    chat_id="-1112204423696"
    message_id="302254"


    As you can see the chat id is negative which mean this is a private group.

    Could it be that the groups disabled link access to specific message ?

    EDIT: I also just tried the following (nothing is hapenning when i click on the link)

    message_link = f"tg://openmessage?chat_id={chat_id}&message_id={message_id}"


    Thanks

    Continue reading...

Compartilhe esta Página