Answer the question
In order to leave comments, you need to log in
I wanted when you write the word file to the bot, it sends the document. What's my mistake?
@dp.message_handler()
async def echo_all(message: types.Message):
if 'file' in message.text:
await bot.send_document(message.chat.id, open(r'Путь_к_документу/Название_документа.txt,' 'rb'))
Answer the question
In order to leave comments, you need to log in
@dp.message_handler()
async def echo_all(message: types.Message):
if 'file' in message.text:
doc = open(("Path_to_document/Name_document" ) + '.txt', 'rb')
await message. reply_document(doc)
well, you ask to send a document, he sends) what's the problem then?
I wanted when you write the word file to the bot, it sends a document . What's my mistake?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question