Facebook page with many potential spam?

Do you also have a Facebook page that looks like this?

1. Download Tampermonkey for Firefox

https://addons.mozilla.org/en-US/firefox/addon/tampermonkey

2. Create a new script

3. Write this code:

// ==UserScript==
// @name         Bulk Decline Facebook Group Requests with Auto-Scroll
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Automatically declines all group requests and scrolls down to load more
// @author       Dan
// @match        https://www.facebook.com/groups/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function declineRequests() {
        let buttons = document.querySelectorAll('div[aria-label="Decline"]');
        if (buttons.length === 0) {
            console.log("No more requests found!");
            return;
        }

        console.log(`Found ${buttons.length} requests. Declining...`);

        buttons.forEach((button, index) => {
            setTimeout(() => {
                button.click();
                console.log(`Declined ${index + 1}`);
            }, index * 800); // Adjust delay to avoid rate limits
        });

        // Scroll down to load more requests
        setTimeout(() => {
            window.scrollTo(0, document.body.scrollHeight);
            console.log("Scrolling down...");
            setTimeout(declineRequests, 3000); // Wait for new requests to load, then repeat
        }, buttons.length * 800 + 2000);
    }

    // Start the process after 3 seconds
    setTimeout(declineRequests, 3000);
})();

Save and run it when visiting the Potential Spam page – and it runs automatically.

 

Be aware that you can run out of memory, and will have to close the tab and start again.

Leave a Reply