From 145d11234be926b9ba72f2f79ec4c358cefab262 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sun, 8 Oct 2023 14:42:17 +0200 Subject: [PATCH] [Telegram] improve confict error --- Services/Interfaces/telegram_bot_interface/telegram_bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Services/Interfaces/telegram_bot_interface/telegram_bot.py b/Services/Interfaces/telegram_bot_interface/telegram_bot.py index 23beee454..786e50abe 100644 --- a/Services/Interfaces/telegram_bot_interface/telegram_bot.py +++ b/Services/Interfaces/telegram_bot_interface/telegram_bot.py @@ -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: