K
K
Kto Takoi2021-08-24 01:17:15
Python
Kto Takoi, 2021-08-24 01:17:15

How to send telegram zip file by bot?

Look, I need my bot to send a zip file, but it only sends .txt files
, here is the code:
bot.send_document(message.chat.id,r'E:\Games\python\Projects for python\test'+'/' + '{0.username}'.format(message.from_user) + '.zip')

is part of the code if you need more write about '{0.username}' then this is to get the user's alias so that certain files from the computer are thrown to certain users also how the mini parser works. I checked the code and if you change the file in the folder to .txt and change it to .txt in the code itself, then everything works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-08-24
@SoreMix

An example of sending files is in the documentation

doc = open('/tmp/file.txt', 'rb')
tb.send_document(chat_id, doc)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question