Проверку для авторизации убрал специально.  Я сейчас дебажу. Вот функция где ошибка возникает: @app.get('/chat/{chat_id}')
async def chat_page(request: Request, chat_id: int, user=Depends(manager)):
    user_id = user['id']
    client = await get_client(user_id, phonenumber=user['phone_number'])
    # auth_state = await client.get_authorization_state()

    # if auth_state['@type'] != 'authorizationStateReady':
    #     return RedirectResponse(url='/start')

    history = await client.get_chat_history(chat_id=chat_id, limit=50)

    messages = history.messages
    return templates.TemplateResponse('chat.html', {'request': request, 'messages': messages, 'chat_id': chat_id, 'user': user})






Библиотеку клиента использую такую - aiotdlib





Вот текст ошибки:

INFO:     127.0.0.1:53266 - "GET /chat/5744828707 HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
  File "/Users/sergeilogachev/PycharmProjects/tg/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
  File "/Users/sergeilogachev/PycharmProjects/tg/main.py", line 103, in chat_page
    history = await client.get_chat_history(chat_id=chat_id, limit=50)
AttributeError: 'Client' object has no attribute 'get_chat_history'. Did you mean: 'iter_chat_history'?