Answer the question
In order to leave comments, you need to log in
How to save Audio to a variable?
Hello, this is the case, so I decided to put the bot into a cart, and now I need the bot to receive the audio message and save it to a variable for further work with it, that's what happened to me, but I can't output the data from the variable to another functions.
@bot.message_handler(commands=['start'])
def handle_message(message):
sent = bot.send_message(message.chat.id, 'Пришлите аудио файл :')
bot.register_next_step_handler(sent, save_link)
def save_audio (message):
sent = bot.send_message(message.chat.id, 'Введите текст под аудио :')
audio = message.audio.file_id
bot.register_next_step_handler(sent, audio_description)
def audio_description(message):
bot.send_audio(message.chat.id, audio)
Answer the question
In order to leave comments, you need to log in
You can pass additional parameters
bot.register_next_step_handler(sent, audio_description, audio)
...
def audio_description(message, audio):
And is it intended that you pass the save_link function to register_next_step_handler , and you have the save_audio function declared ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question