Код метода:
async def GetUserByUsername(username: str, bot_func: Client):
if bot_func.is_connected == True:
await bot_func.stop()
await bot_func.start()
user = await bot_func.invoke(ResolveUsername(username=username))
await bot_func.stop()
return user.users[0]
Ошибка:
2023-02-07 19:24:16,886 (async_telebot.py:543 MainThread) ERROR - TeleBot: "Task <Task pending name='Task-83' coro=<AsyncTeleBot._run_middlewares_and_handlers() running at /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/telebot/async_telebot.py:516> cb=[gather.<locals>._done_callback() at /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/tasks.py:754]> got Future <Task pending name='Task-111' coro=<Dispatcher.handler_worker() running at /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyrogram/dispatcher.py:202>> attached to a different loop"
Возникает ошибка при вызове данного метода, что я мог неправильно сделать?
Библиотека с ТГ Апи: Pyrogram