Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const fetch = require('node-fetch');
- const { tokens, auths } = require('../../data/_db');
- let lastIndex = 0;
- let tokens_and_auths = tokens.map((token, index) => ({token,auth: auths[index]}));
- async function getProfile(userId) {
- const {token,auth,UserAgent,cok_1} = tokens_and_auths[lastIndex];
- try {
- lastIndex = (lastIndex + 1) % tokens_and_auths.length;
- const response = await fetch(`https://discord.com/api/v10/users/${userId}/profile`, {
- headers: {
- "Content-Type": "application/json",
- Authorization: token,
- "User-Agent": UserAgent,
- cookie: cok_1,
- },
- });
- if (!response.ok) {
- console.error('Failed to fetch profile:', response.statusText);
- return null;
- }
- const json = await response.json();
- return json && typeof json === "object" ? json : null;
- } catch (error) {
- console.error('Error fetching user profile:', error);
- return null;
- }
- }
- module.exports = getProfile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement