antijob / neuro-parser

Other
3 stars 0 forks source link

Проблемы добавления бота в канал #195

Closed Vldln closed 3 weeks ago

Vldln commented 1 month ago

Ошибка вышла при добавлении бота в чат и попытке вызвать команду caget решилось удалением бота и порным удалением Обработка ошибок должна быть встроена в код и показываться пользователю бота. Если речь о том что канал не найдет пусть пишет что нужно удалить и снова добавить бота.

ERROR:telegram.ext.dispatcher:No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/home/github-actions/code/server/apps/bot/logic/handlers.py", line 76, in categ
    cats = Channel.objects.get(channel_id__exact=chat_id)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
server.apps.bot.models.Channel.DoesNotExist: Channel matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 557, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/handler.py", line 199, in handle_update
    return self.callback(update, context)
  File "/home/github-actions/code/server/apps/bot/logic/handlers.py", line 81, in categ
    raise type(e)(f"Category command in chat {chat_id} exception happend: {e}")
server.apps.bot.models.Channel.DoesNotExist: Category command in chat -4206810298 exception happend: Channel matching query does not exist.
ERROR:telegram.ext.dispatcher:No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/home/github-actions/code/server/apps/bot/logic/handlers.py", line 165, in chat_member_left
    channel = Channel.objects.get(channel_id=chat_id)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
server.apps.bot.models.Channel.DoesNotExist: Channel matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 557, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/handler.py", line 199, in handle_update
    return self.callback(update, context)
  File "/home/github-actions/code/server/apps/bot/logic/handlers.py", line 168, in chat_member_left
    raise type(e)(f"When remove bot from chat {chat_id} exception happend: {e}")
server.apps.bot.models.Channel.DoesNotExist: When remove bot from chat -4206810298 exception happend: Channel matching query does not exist.
SAVED
2024-07-29 06:02:30 [WARNING] Not Found: /.en