Advertisement
antonio_pedro

CheckName

Jan 17th, 2024 (edited)
1,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const nicks = ["x", "y", "z"]; // se leu mamou
  2.  
  3. const tryName = async () => {
  4.   for (let i = 0; i < nicks.length; i++) {
  5.     let currentWord = nicks[i];
  6.  
  7.     await new Promise(r => setTimeout(r, 0));
  8.     let res = await fetch(`antoniopedro.com/api/user/avatars/check-name?name=${currentWord}`, {
  9.       "headers": {
  10.         "content-type": "application/json;charset=UTF-8",
  11.       },
  12.       "mode": "cors",
  13.       "credentials": "include"
  14.     });
  15.  
  16.     if ((await res.json()).isAvailable) {
  17.       console.log(`Conta Disponível: ${currentWord}`);
  18.     } else {
  19.       // Ação a ser tomada caso o nick não esteja disponível
  20.     }
  21.   }
  22.  
  23.   tryName(); // continua verificando os nicks
  24. }
  25.  
  26. tryName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement