From 8181394b407c601c1e540766e3527e60d15de8fa Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Jul 2026 05:28:27 +0500 Subject: [PATCH] fix(lolzteam): add type conversion and validation checks --- tgbot/routers/admin/admin_payments.py | 2 +- tgbot/services/api_lolzteam.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tgbot/routers/admin/admin_payments.py b/tgbot/routers/admin/admin_payments.py index 5e2b2e7..8097551 100644 --- a/tgbot/routers/admin/admin_payments.py +++ b/tgbot/routers/admin/admin_payments.py @@ -320,7 +320,7 @@ async def payments_lolzteam_merchant_id_get( ).check() if status: - await Paymentsx().update(lolzteam_merchant_id=get_merchant_id) + await Paymentsx().update(lolzteam_merchant_id=int(get_merchant_id)) await cache_message.edit_text("🟢 Lolzteam был успешно изменён ✅") else: await cache_message.edit_text("🟢 Не удалось изменить Lolzteam ❌") diff --git a/tgbot/services/api_lolzteam.py b/tgbot/services/api_lolzteam.py index c24efe8..5aa3bb7 100644 --- a/tgbot/services/api_lolzteam.py +++ b/tgbot/services/api_lolzteam.py @@ -104,7 +104,12 @@ class LolzteamAPI: status, response = await self._request("me", method="GET") merchant_valid = False - if status and "errors" not in response and self.merchant_id: + if ( + status + and "errors" not in response + and "balances" in response["user"] + and self.merchant_id + ): balances = response["user"]["balances"] for balance in balances: @@ -125,7 +130,7 @@ class LolzteamAPI: elif status and "errors" not in response and not self.merchant_id: return True, ded( f""" - 🟢 Lolzteam полностью функционирует ✅ + 🟢 Lolzteam функционирует ✅ ➖➖➖➖➖➖➖➖➖➖ ▪️ Токен: {self.token} ▪️ Айди: {response['user']['user_id']}