title: Download a file from Telegram using aiogram bot-framework in Python
body: <p>How can I download a file which has been sent by a user in chat?</p>
  <h3>For example</h3>
  <p>I need to download the file <code>moonloader.log</code> from Telegram to my local path <code>C:\text-folder\moonloader.log</code> and read it.</p>
  <h3>Code so far</h3>
  <pre class="lang-py prettyprint-override"><code>def checkFile(path):
      if os.path.isfile(path):
          f = open(path, 'r')
          log = f.read()
          print('начинаю проверку...')
          # check log
          result = re.search('MoonLoader v.(.+) loaded.', log)
          if result:
              moonlog_version = result.group(1)
              print('• Версия moonloader: ' + moonlog_version)
              for err in range(0, len(errors)):
                  for i in errors[err]:
                      print('   • Ошибка: ' + errors[err][i])
  
  # ON RECEIVE FILE 
  @dp.message_handler(content_types=types.ContentType.DOCUMENT)
  async def fileHandle(message: types.File):
      await message.reply(text='файл получен, начинаю поиск ошибок...')
      ## LOAD FILE CODE
      checkFile(LOADED FILE PATH)
  </code></pre>
  <h3>Updated Code</h3>
  <p>I tried to follow the <a href="https://stackoverflow.com/a/69122846/5730279">answer of hc_dev</a> and added the download method. But not sure how to get the <code>File</code> or <code>file_path</code> from <code>message</code>. I tried this:</p>
  <pre class="lang-py prettyprint-override"><code>def download_file(file: types.File):
      file_path = file.file_path 
      destination = r'C:\\Users\\admin\\Desktop\\moonlog inspector\\download'
      destination_file = bot.download_file(file_path, destination) # ON RECEIVE FILE 
  
  @dp.message_handler(content_types=types.ContentType.DOCUMENT)
  async def fileHandle(message: types.Document):
      await message.reply(text='файл получен, начинаю поиск ошибок...')
      ## LOAD FILE CODE
      download_file(message.file_id)
  </code></pre>
  <p>But when running it raises the error:</p>
  <blockquote>
  <p>'Message' object has no attribute 'file_id'</p>
  </blockquote>