From 16179148b5d46d51cd59c7de6a21f46c92184c5a Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 10 May 2025 23:15:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20`get=5Fte?= =?UTF-8?q?legram=5Fid`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClanStat/__init__.py | 2 +- ClanStat/utils.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ClanStat/__init__.py b/ClanStat/__init__.py index 0b89ae3..d2ed087 100644 --- a/ClanStat/__init__.py +++ b/ClanStat/__init__.py @@ -1,6 +1,6 @@ # Информация о программе __author__ = 'Alexander Popov' -__version__ = (2, 2, 2) +__version__ = (2, 2, 3) # Импорт модулей стандартной библиотеки from os import getenv diff --git a/ClanStat/utils.py b/ClanStat/utils.py index cc9731c..19a6d09 100644 --- a/ClanStat/utils.py +++ b/ClanStat/utils.py @@ -8,13 +8,11 @@ from . import client async def get_telegram_id(username: str) -> int: """Возвращает Telegram ID""" - # TODO: Добавить проверку на неправильный юзернейм, - # в процессе отладки типсон поменял ник обратно, - # а самому лень этим заниматься - - telegram_user = await client.get_users(username) - - return telegram_user.id + try: + telegram_user = await client.get_users(username) + return telegram_user.id + except Exception as e: + return None async def get_telegram_data(message: Message, idx: int) -> tuple():