@m-c-a-v

Как исправить непонятную ошибку?

Пишу бота для одного коммьюнити в телеграм, нужно было протестировать функцию, запустил его. На выходе длиннющая ошибка(внизу) без указания места, где я накосячил. То есть проблема не у меня?

poetry run python bot/runner.py
Cause exception while process update id=290049228 by bot id=6588452379
AttributeError: 'Message' object has no attribute 'old_chat_member'
Traceback (most recent call last):
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/pydantic/main.py", line 726, in __getattr__
    return pydantic_extra[item]
           ~~~~~~~~~~~~~~^^^^^^
KeyError: 'old_chat_member'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 308, in _process_update
    response = await self.feed_update(bot, update, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 157, in feed_update
    response = await self.update.wrap_outer_middleware(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
    return await handler(event, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in __call__
    return await handler(event, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/fsm/middleware.py", line 41, in __call__
    return await handler(event, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 120, in trigger
    return await wrapped_inner(event, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
    return await wrapped()
           ^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 275, in _listen_update
    return await self.propagate_event(update_type=update_type, event=event, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 116, in propagate_event
    return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 111, in _wrapped
    return await self._propagate_event(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 136, in _propagate_event
    response = await observer.trigger(event, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 112, in trigger
    result, data = await handler.check(event, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 93, in check
    check = await event_filter.call(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
    return await wrapped()
           ^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/aiogram/filters/chat_member_updated.py", line 194, in __call__
    old = member_updated.old_chat_member
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcav/projects/TheEighth_Bot/.venv/lib/python3.11/site-packages/pydantic/main.py", line 728, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}') from exc
AttributeError: 'Message' object has no attribute 'old_chat_member'
  • Вопрос задан
  • 181 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы