RuntimeWarning: coroutine 'send_message_date' was never awaited del work_item

44 Views Asked by At

An error occurs when adding and running tasks.

sched = BlockingScheduler()


@dp.message(TimeTaskOrder.date)
async def add_time_task_date(message: types.Message, state: FSMContext):
    chat_id = message.chat.id
    task['date'] = datetime.datetime.strptime(message.text, "%d.%m.%Y %H:%M")
    taskmodel = TimeTask(profile=task['profile'], title=task['title'], date=task['date'])
    await taskmodel.asave()
    await message.answer('task is created')

    sched.add_job(send_message_date, 'date', run_date=task['date'], args=[bot, chat_id, task['title']])
    sched.start()
async def send_message_date(bot:Bot, id, title):
    await bot.send_message(id, f'your task: {title}')

Also I have the problem : Enable tracemalloc to get the object allocation traceback

0

There are 0 best solutions below