Вы должны использовать успешный обратный вызов для обработки того, что вам нужно после загрузки файла. Result и user_data - это параметры, из которых вы можете получить file_id и access_hash.вот полный пример:
@dispatcher.message_handler(PhotoFilter())
def ask_photo(bot, update):
user_peer = update.get_effective_user()
def file_upload_success(result, user_data):
"""Its the link of upload photo but u cant see anything with it because you need to take a token from server.
actually this link is just for uploading a file not download. If you want to download this file you should
use get_file_download_url() and take a token from server.
"""
print("upload was successful : ", result)
print(user_data)
file_id = str(user_data.get("file_id", None))
access_hash = str(user_data.get("user_id", None))
print("fileIDD: ", file_id, "access", access_hash)
v_message = PhotoMessage(file_id=file_id, access_hash=access_hash, name="Bale", file_size='11337',
mime_type="image/jpeg", caption_text=TextMessage(text="Bale"),
file_storage_version=1, thumb=None)
bot.send_message(v_message, user_peer, success_callback=success, failure_callback=failure)
bot.upload_file(file="../files/upload_file_test.jpeg", file_type="file", success_callback=file_upload_success,
failure_callback=failure)
message = TextMessage("Thanks \nplease send a Hello voice message.")
user_peer = update.get_effective_user()
bot.send_message(message, user_peer, success_callback=success, failure_callback=failure)
dispatcher.register_conversation_next_step_handler(update, MessageHandler(VoiceFilter(), finish_conversion))