Skip to content

Commit

Permalink
[Telegram] improve confict error
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Oct 8, 2023
1 parent 3f5e986 commit 145d112
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Services/Interfaces/telegram_bot_interface/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ async def command_error(update: telegram.Update, context: telegram.ext.ContextTy
@staticmethod
def handle_polling_error(error):
if isinstance(error, (telegram.error.NetworkError, telegram.error.Conflict)):
error_message = f"Telegram bot error: {error} ({error.__class__.__name__})"
if isinstance(error, telegram.error.Conflict):
error_message = f"The configured Telegram bot is already connected to a different " \
f"software. Please create a different Telegram bot for each of your simultaneous " \
f"OctoBots ({error})"
else:
error_message = f"Telegram bot error: {error} ({error.__class__.__name__})"
if TelegramBotInterface.get_error_log_level(error) is logging.ERROR:
TelegramBotInterface.get_logger().error(error_message)
elif TelegramBotInterface.get_error_log_level(error) is logging.WARNING:
Expand Down

0 comments on commit 145d112

Please sign in to comment.