Answer the question
In order to leave comments, you need to log in
How to send a folder to Telegram Bot?
How to send folder to telegram bot? I think you need to use sendDocument for this, but there you can only send files like .txt or .pdf, etc. How do you send a whole folder?
Library - telebot
Answer the question
In order to leave comments, you need to log in
zipfile library to help.
zfname = f'{Название архива}.zip'
with ZipFile(zfname, "w") as nz:
nz.write(f'[путь]/{Название файла1}.[расширение]')
nz.write(f'[путь]/{Название файла2}.[расширение]')
f = open(zfname, 'rb')
bot.send_document([chat_id], f)
I doubt that you will be able to send the folder itself. You can send the contents of this folder and do something with it. And how to implement it - in a cycle or just drive in one by one each name is already a personal matter for everyone)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question