Answer the question
In order to leave comments, you need to log in
How can a bot send a file with any extension to Telegram (aiogram)?
I can't send the file to myself or any other user in any way. PAMAGITI
My attempt:
@dp.message_handler(lambda message: message.text == "Отправить на проверку", state='*')
async def send_order_main(message: types.Message):
if (db.get_role(message.from_user.id) == 'исполнитель' or 'админ'):
state = dp.current_state(user=message.from_user.id)
await message.reply('Отправьте файл заказа(файл с расширением .arexport):', reply=False)
await state.set_state(SendOrderStates.all()[0])
else:
pass
@dp.message_handler(state=SendOrderStates.TEST_STATE_0)
async def send_order_finish(message: types.Message):
state = dp.current_state(user=message.from_user.id)
SendOrderStates.document = message.document
print(SendOrderStates.document)
await message.forward(775430746, disable_notification=False)
await state.finish()
Answer the question
In order to leave comments, you need to log in
You have a lot of errors here, here is how your handlers should look like:
from aiogram.dispatcher import FSMContext
@dp.message_handler(text="Отправить на проверерку", user_id=[список из ID (int) админов и исполнителей], state="*")
async def send_order_main(message: types.Message, state: FSMContext):
await state.set_state("название стейта")
await message.answer("Отправьте файл заказа(файл с расширением .arexport):")
@dp.message_handler(content_types=types.ContentType.DOCUMENT, state="название стейта")
async def send_order_finish(message: types.Message, state: FSM Context):
msg_document = message.document.file_id
await dp.bot.send_document(775430746, msg_document)
await state.reset_state()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question