Guest User

Untitled

a guest
Jan 31st, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. from aiogram import Bot, Dispatcher, types, executor
  2.  
  3. import os
  4.  
  5. TOKEN_BOT = '####'
  6. bot = Bot(TOKEN_BOT)
  7. dp = Dispatcher(bot)
  8. src = os.getcwd()
  9.  
  10.  
  11. @dp.message_handler(content_types=types.ContentType.DOCUMENT)
  12. async def scan_message(file: types.File):
  13.     file_info = await bot.get_file(file.document.file_id)
  14.     await bot.download_file(file_info, src + '/' + file.document.file_name)
  15.        
  16.    
  17. if __name__ == '__main__':
  18.     executor.start_polling(dp)
Advertisement
Add Comment
Please, Sign In to add comment