'How Can I download media by Telethon Full API

I am trying to download media using the following code. He writes me "File saved to None". There is definitely media in the message.

from telethon import TelegramClient
from telethon.tl.functions.messages import GetMessagesRequest

api_id = 150
api_hash = '5f8599d664ec942b5d4e550e6'
token = "5226:cpvv-4s2Uzyvfxk4i65fvBCDj2JrQ"
client = TelegramClient('bot', api_id, api_hash).start(bot_token=token)
async def main():
    result = await client(GetMessagesRequest(id=[2210]))    
    message = result.messages[0]
    path = await message.download_media(file="media")
    print('File saved to', path)  # printed after download is done
    
with client:
    client.loop.run_until_complete(main())```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source