diff --git a/setting/telegrambot.py b/setting/telegrambot.py index 58a94fd..7edda19 100644 --- a/setting/telegrambot.py +++ b/setting/telegrambot.py @@ -4,6 +4,7 @@ # @Software: PyCharm from typing import Optional +import requests from dotenv import load_dotenv from loguru import logger from pydantic import Field, model_validator @@ -49,8 +50,13 @@ def bot_validator(self): self.bot_id = str(_bot.id) self.bot_username = _bot.username self.bot_link = f"https://t.me/{self.bot_username}" + except requests.exceptions.ConnectTimeout: + logger.error( + "\nšŸ€TelegramBot Connect Error --error ConnectTimeout, Please Check Your Network To Telegram" + ) + raise requests.exceptions.ConnectTimeout except Exception as e: - logger.error(f"\nšŸ€TelegramBot Token Not Set --error {e}") + logger.error(f"\nšŸ€TelegramBot Connect Error --error {e}") else: logger.success( f"šŸ€TelegramBot Init Connection Success --bot_name {self.bot_username} --bot_id {self.bot_id}"