Telebot
A program for sending a file to the sandbox ATHENA and giving a response.
Telebot
Send the file to the telegram bot. Get a PDF report with the results of the antivirus scan.
Telebot is created to upload files for checking. Then the files are sent via API to the ATHENA Sandbox and a response is returned. The response contains the antivirus verdict.
With the help of BotFaver a new bot was created. I studied how to work with API and to upload files to a telegram bot and to generate a PDF report on the results of the program's work.
Code (small part)
async def handle_any_media_wo_no_caption (message: types.Message):
await message.answer(f"Получил Ваш файл. Приступаю к обработке. Через минуту сообщу новую информацию.")
if message.document:
#получить тип документа. сгенерировать имя
FILE_UNIQUE_ID = message.document.file_unique_id
FILE_INFO = await BOT.get_file(message.document.file_id)
FILEEXT = FILE_INFO.file_path.split(".")[-1]
NAME = FILE_UNIQUE_ID+(".")+FILEEXT
#Сохранение файла на локальный диск
FILE = await BOT.get_file(message.document.file_id)
await BOT.download_file(FILE.file_path, NAME)
elif message.photo:
# сгенерировать имя фотографии
await message.answer(f"Пожалуйста, загрузите фото, как файл. "
f"Для этого выберете 'Send as File' "
f"в верхнем или контекстном меню загружаемого фото")