HonestlyDex

addTokens

Oct 29th, 2021 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function getName() {
  2.     const response = await fetch('https://api.blooket.com/api/users/verify-token', {
  3.         method: "GET",
  4.         headers: {
  5.             "accept": "application/json, text/plain, */*",
  6.             "accept-language": "en-US,en;q=0.9,ru;q=0.8",
  7.         },
  8.         credentials: "include"
  9.     });
  10.     const data = await response.json();
  11.  
  12.     return data.name;
  13. };
  14.  
  15. async function addCurrencies() {
  16.     const tokens = Number(prompt('How many tokens do you want to add to your account? (500 daily)'));
  17.  
  18.     if (tokens > 500) {
  19.         alert('You can only add up to 500 tokens daily.');
  20.     };
  21.  
  22.     const response = await fetch('https://api.blooket.com/api/users/add-rewards', {
  23.         method: "PUT",
  24.         headers: {
  25.             "referer": "https://www.blooket.com/",
  26.             "content-type": "application/json",
  27.         },
  28.         credentials: "include",
  29.         body: JSON.stringify({
  30.             addedTokens: tokens,
  31.             addedXp: 300,
  32.             name: await getName()
  33.         })
  34.     });
  35.  
  36.     if (response.status == 200) {
  37.         alert(`${tokens} tokens and 300 XP added to your account!`);
  38.     } else {
  39.         alert('An error occured.');
  40.     };
  41.  
  42. };
  43.  
  44. addCurrencies();
Add Comment
Please, Sign In to add comment