tamaro_skaljic

redeem-multiple-codes

Feb 6th, 2026
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.68 KB | Software | 0 0
  1. (async function(codes) {
  2.   const delay = (mult = 1) => new Promise(r => setTimeout(r, (1500 + Math.random() * 500) * mult));
  3.   const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
  4.  
  5.   let mult = 1;
  6.   for (let i = 0; i < codes.length; i++) {
  7.     const input = document.getElementById('redeemCode');
  8.     const btn = document.getElementById('submit-code-btn');
  9.    
  10.     nativeInputValueSetter.call(input, codes[i]);
  11.     input.dispatchEvent(new Event('input', { bubbles: true }));
  12.     await delay(mult);
  13.    
  14.     btn.click();
  15.     await delay(mult);
  16.    
  17.     btn.click();
  18.     await delay(mult);
  19.    
  20.     const helper = document.getElementById('redeemCode-helper-text');
  21.     const helperText = helper ? helper.textContent.trim() : '';
  22.    
  23.     if (helperText.includes('too frequent')) {
  24.       mult *= 2;
  25.       console.log(`[${i + 1}/${codes.length}] ${codes[i]} → Throttled! Delay ${mult}x. Retrying...`);
  26.       i--;
  27.     } else if (helperText) {
  28.       mult = 1;
  29.       console.log(`[${i + 1}/${codes.length}] ${codes[i]} → ${helperText}`);
  30.     } else {
  31.       const snackbar = document.getElementById('notifications-snackbar');
  32.       const snackText = snackbar ? snackbar.textContent.trim() : '';
  33.       if (snackText.includes('Successfully redeemed code')) {
  34.         mult = 1;
  35.         console.log(`[${i + 1}/${codes.length}] ${codes[i]} → ${snackText}`);
  36.       } else {
  37.         mult *= 2;
  38.         console.log(`[${i + 1}/${codes.length}] ${codes[i]} → No response detected. Delay ${mult}x. Retrying...`);
  39.         i--;
  40.       }
  41.     }
  42.   }
  43.  
  44.   console.log('All codes processed!');
  45. })([
  46.   "TODO",
  47.   "TODO",
  48.   "TODO"
  49. ]);
Advertisement
Add Comment
Please, Sign In to add comment