Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from aiogram import Bot, Dispatcher, types, executor
- import os
- TOKEN_BOT = '####'
- bot = Bot(TOKEN_BOT)
- dp = Dispatcher(bot)
- src = os.getcwd()
- @dp.message_handler(content_types=types.ContentType.DOCUMENT)
- async def scan_message(file: types.File):
- file_info = await bot.get_file(file.document.file_id)
- await bot.download_file(file_info, src + '/' + file.document.file_name)
- if __name__ == '__main__':
- executor.start_polling(dp)
Advertisement
Add Comment
Please, Sign In to add comment