@XWR

Ошибка: bot was blocked by the user как обойти эту ошибку на aiogram?

Получаю ошибку:
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-9' coro=<Dispatcher._process_polling_updates() done, defined at /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py:409> exception=BotBlocked('Forbidden: bot was blocked by the user')>
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
    return await asyncio.gather(*tasks)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
    response = await handler_obj.handler(*args, **partial_data)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update
    return await self.message_handlers.notify(update.message)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
    response = await handler_obj.handler(*args, **partial_data)
  File "<string>", line 41, in process_startmmand
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/types/message.py", line 359, in answer
    return await self.bot.send_message(
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/bot/bot.py", line 314, in send_message
    result = await self.request(api.Methods.SEND_MESSAGE, payload)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/bot/base.py", line 208, in request
    return await api.make_request(self.session, self.server, self.__token, method, data, files,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/bot/api.py", line 140, in make_request
    return check_result(method, response.content_type, response.status, await response.text())
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/bot/api.py", line 121, in check_result
    exceptions.Unauthorized.detect(description)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/aiogram/utils/exceptions.py", line 140, in detect
    raise err(cls.text or description)
aiogram.utils.exceptions.BotBlocked: Forbidden: bot was blocked by the user


Как сделать чтобы бот на Aiogram просто игнорит её и даже не выводил в консоль?
  • Вопрос задан
  • 1269 просмотров
Решения вопроса 1
Zoominger
@Zoominger Куратор тега Python
System Integrator
--- Окей, Гугл, как обрабатывать исключения на Пистоне?
--- try-catch
--- Спасибо, Гугл.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

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

Похожие вопросы
22 нояб. 2024, в 22:26
3500 руб./за проект
22 нояб. 2024, в 21:47
3000 руб./за проект
22 нояб. 2024, в 21:44
50000 руб./за проект