Answer the question
In order to leave comments, you need to log in
How to click on a button in a telegram bot using Pyrogram?
There is a telegram bot for downloading audio from Spotify (@spotify_down_bot)
I need to download audio from there, for this I send a link to the audio to the bot and after that the bot sends me messages with buttons. To start downloading audio, click on the Download this Song button!
I tried to click on this button using
client.request_callback_answer()
I did it like this
Client.request_callback_answer(chat_id= 1130976121, message_id = message.message_id, callback_data = "d_mp3_slow 1T18xjRxt5m22ZOwMPMRhc")
from pyrogram import Client
import config
import time
app = Client("cyberpunk", config.api_id, config.api_hash, config.phone_number)
@app.on_message()
def message(Client, message):
if message.chat.username == "spotify_down_bot":
print(message)
log = open("log", "a")
log.write(f"\n {message}")
log.close()
Client.request_callback_answer(
chat_id= 1130976121,
message_id = message.message_id,
callback_data = "d_mp3_slow 1T18xjRxt5m22ZOwMPMRhc"
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question