Advertisement
BETAlwrd

Untitled

Jun 29th, 2025
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2. const fetch = require('node-fetch');
  3. const { tokens, auths } = require('../../data/_db');
  4. let lastIndex = 0;
  5. let tokens_and_auths = tokens.map((token, index) => ({token,auth: auths[index]}));
  6.  
  7. async function getProfile(userId) {
  8.     const {token,auth,UserAgent,cok_1} = tokens_and_auths[lastIndex];
  9.  
  10.     try {
  11.         lastIndex = (lastIndex + 1) % tokens_and_auths.length;
  12.         const response = await fetch(`https://discord.com/api/v10/users/${userId}/profile`, {
  13.                 headers: {
  14.                     "Content-Type": "application/json",
  15.                     Authorization: token,
  16.                     "User-Agent": UserAgent,
  17.                     cookie: cok_1,
  18.             },
  19.         });
  20.  
  21.         if (!response.ok) {
  22.             console.error('Failed to fetch profile:', response.statusText);
  23.             return null;
  24.         }
  25.  
  26.         const json = await response.json();
  27.  
  28.         return json && typeof json === "object" ? json : null;
  29.  
  30.     } catch (error) {
  31.         console.error('Error fetching user profile:', error);
  32.         return null;
  33.     }
  34. }
  35.  
  36. module.exports = getProfile;
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement