R
R
Ruslan2022-02-16 17:25:56
Python
Ruslan, 2022-02-16 17:25:56

How to get a link to a file uploaded by a user to a bot?

Hello! There is a bot that goes into machine state and receives a video file from the user.

await FSMLoadvid.videoinfo.set()
await message.reply('Отправьте свой видео файл', reply_markup=cancel_kb)

async def load_video(message: types.Message, state=FSMContext):
    async with state.proxy() as data:
        data['video'] = message.video.file_id
        data['videoPath'] = message.video.file_path
        print(data['videoPath'])
        data['usId'] = message.from_user.id

Gives an error AttributeError: 'Video' object has no attribute 'file_path'
I look at the documentation, and it's true that video has no file_path attribute.
I need these videos to be displayed in the bot's web interface, that is, to load them on the site. How then to implement it? How do I even get the path to these downloaded files? Or in aiogram they are available only in the bot itself? Which way to go then?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question