@dp.message_handler(commands=['цитата'])
async def random_quote(message: types.Message):
x= quotes[randint(0,388)]
await message.answer(x)
async def scheduler():
schedule.every().day.at("19:23").do(job)
loop = asyncio.get_event_loop()
while True:
await schedule.run_pending()
await asyncio.sleep(1)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.create_task(scheduler())
executor.start_polling(dp,skip_updates=True)
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<scheduler() done, defined at c:\Users\zaggg\Desktop\WeatherBot\main.py:67> exception=TypeError('Passing coroutines is forbidden, use tasks explicitly.')>
Traceback (most recent call last):
File "c:\Users\zaggg\Desktop\WeatherBot\main.py", line 71, in scheduler
await schedule.run_pending()
File "C:\Users\zaggg\AppData\Local\Programs\Python\Python311\Lib\site-packages\aioschedule\__init__.py", line 544, in run_pending
await default_scheduler.run_pending()
File "C:\Users\zaggg\AppData\Local\Programs\Python\Python311\Lib\site-packages\aioschedule\__init__.py", line 111, in run_pending
return await asyncio.wait(jobs, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\zaggg\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 415, in wait
raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")
TypeError: Passing coroutines is forbidden, use tasks explicitly.
C:\Users\zaggg\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py:1910: RuntimeWarning: coroutine 'Job.run' was never awaited
handle = None # Needed to break cycles when an exception occurs.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback