Add Friend Bot
Add Friend Bot
", 15);
var delayTime = prompt("Delay Time", 5)*1000;
var added = 0;
async function addFriends() {
try {
let buttons = document.querySelectorAll("[aria-label='Add friend']");
if (!buttons.length) {
buttons = document.querySelectorAll("[aria-label='Add Friend']");
}
let totalButtons = buttons.length;
console.log('Total profiles on page: '+totalButtons);
for (let i = 0; i < buttons.length; i++) {
let target = buttons[i];
if (target) {
target.click();
added++;
console.log("Add Friend Button Clicked: " + added);
if (added % 20 == 0) {
//sleep
let wait = 30 * 1000;
console.log("Waiting for " + wait / 1000 + " seconds!");
await new Promise(r => setTimeout(r, wait));
}
// Wait for user specified time
await new Promise(r => setTimeout(r, delayTime));
// check if the number of added friends is equal to the number of "Add friend"
buttons available on the page
if (added == totalButtons && added < total) {
// Get current end scroll position
const currentScrollPosition = window.scrollY;
// Scroll to a position 100 pixels below the current end scroll position
window.scrollTo(currentScrollPosition, currentScrollPosition + 10000);
// wait for the page to complete the scroll
await new Promise(r => setTimeout(r, 1000));
buttons = document.querySelectorAll("[aria-label='Add friend']");
if (!buttons.length) {
buttons = document.querySelectorAll("[aria-label='Add Friend']");
}
totalButtons = buttons.length;
} else if (added >= total) {
alert(`Friend Requests Sent: ${added} \n\n ~Script by: Tigerzplace~`);
break;
}
}
}
} catch (err) {
console.log(`Error Occurred: ${err}`);
}
}