skip to Main Content

I use a user bot in pyrogram to save links from a bot to a personal channel. I use this code:

def forwardlik(mensaje)
    if "Link!" in mensaje.text:
        mensaje.forward(ids["channel"])

But now the bot it’s sending the link with a button inline and I don’t know how to make the program press the button and send only the link to my channel.
Someone can help me?

Example pictures:
enter image description here

enter image description here

enter image description here

2

Answers


  1. @Client.on_message(Filters.chat("<--botid-->>"))
    async def foo(c, message):
        # The below condition will take the link from the first button and if it exists it will print the link
        if x:=message.reply_markup["inline_keyboard"][0][0].url:
            print(x) 
        
    

    you can take the var x and forward it to another channel

    Login or Signup to reply.
  2. Late to the party, but…

    You can use the Message bound method click() to get a string in case the button is a url.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search