X
X
XWR2021-06-17 14:38:03
Python
XWR, 2021-06-17 14:38:03

Error: bot was blocked by the user how to get around this error on aiogram?

I am getting an error:

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


How can I make the bot on Aiogram just ignore it and not even output it to the console?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2021-06-17
@XWR

--- Ok, Google, how to handle exceptions on Piston?
--- try-catch
--- Thanks Google.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question