ghiwar

auto decline pending group post

Apr 30th, 2025 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let rejectedCount = 0;
  2. let consecutiveErrors = 0;
  3. let connectionErrorCount = 0;
  4.  
  5. async function autoDecline() {
  6.     while (true) {
  7.         try {
  8.             // Cari semua tombol dengan teks 'Decline'
  9.             let buttons = Array.from(document.querySelectorAll("span"))
  10.                 .filter(el => el.textContent.trim() === "Decline");
  11.  
  12.             if (buttons.length <= 1) {
  13.                 console.log("No more posts to decline, checking again in 5 minutes...");
  14.                 await new Promise(r => setTimeout(r, 300000)); // 5 menit
  15.                 location.reload(); // Refresh halaman
  16.                 continue;
  17.             }
  18.  
  19.             for (let btn of buttons) {
  20.                 try {
  21.                     btn.click();
  22.                     rejectedCount++;
  23.                     console.log(`Post #${rejectedCount} rejected.`);
  24.                     consecutiveErrors = 0;
  25.                     connectionErrorCount = 0;
  26.                     await new Promise(r => setTimeout(r, 1000)); // delay 1 detik antar klik
  27.                 } catch (err) {
  28.                     console.error("Rejection failed:", err);
  29.                     continue;
  30.                 }
  31.             }
  32.  
  33.             // Scroll sedikit ke bawah untuk memuat lebih banyak postingan
  34.             await new Promise(r => setTimeout(r, 5000));
  35.             window.scrollBy(0, 500);
  36.  
  37.         } catch (err) {
  38.             consecutiveErrors++;
  39.             console.error("Error:", err);
  40.  
  41.             if (consecutiveErrors >= 3) {
  42.                 console.error("Encountered 3 consecutive errors, stopping the script.");
  43.                 break;
  44.             }
  45.  
  46.             await new Promise(r => setTimeout(r, 10000)); // tunggu 10 detik
  47.             location.reload();
  48.         }
  49.     }
  50. }
  51.  
  52. autoDecline();
  53.  
Add Comment
Please, Sign In to add comment