Merge pull request #97 from Rilliat/v1.6.9

maybe fixed override_text
pull/99/head
Who? 2025-02-09 02:42:07 +10:00 committed by GitHub
commit 051fe3eab6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from logging.handlers import RotatingFileHandler
import herokutl
from aiogram.utils.exceptions import NetworkError
from herokutl.errors import PersistentTimestampOutdatedError
from . import utils
from .tl_cache import CustomTelegramClient
@ -66,9 +67,9 @@ linecache.getlines = getlines
def override_text(exception: Exception) -> typing.Optional[str]:
"""Returns error-specific description if available, else `None`"""
if isinstance(exception, NetworkError):
if isinstance(exception, (NetworkError, asyncio.exceptions.TimeoutError)):
return "✈️ <b>You have problems with internet connection on your server.</b>"
if 'Telegram is having internal issues' in str(exception):
elif isinstance(exception, PersistentTimestampOutdatedError):
return "✈️ <b>Telegram has problems with their datacenters.</b>"
return None