2

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

Tibebes. M
  • 6,940
  • 5
  • 15
  • 36

2 Answers2

0
@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

Alen Paul Varghese
  • 1,278
  • 14
  • 27
0

Late to the party, but...

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

ColinShark
  • 1,047
  • 2
  • 10
  • 18