Skip to content

Instantly share code, notes, and snippets.

@ThomazPom
Last active April 1, 2021 16:07
Show Gist options
  • Save ThomazPom/a3953e8fbcd3128f96c09725bd53f789 to your computer and use it in GitHub Desktop.
Save ThomazPom/a3953e8fbcd3128f96c09725bd53f789 to your computer and use it in GitHub Desktop.
Auto answer people on Facebook page
// ==UserScript==
// @name FAQ AutoAnswer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.facebook.com/ListeReduction/inbox*
// @grant none
// ==/UserScript==
var nlist = [];
function goo() {
var toclickts = nlist.shift();
if(!toclickts)
{
console.log("Nothing to do")
return;
}
toclickts.classList.add("already_checked");
var toclick=toclickts.parentElement.parentElement.parentElement.parentElement
toclick.click();
setTimeout(function() {
var lrmessages = [].slice.call(document.querySelectorAll("[data-tooltip-position='right']"))
var lastlrmessage = lrmessages.pop();
if (lastlrmessage.innerText.includes("répondre dans quelques instants")) {
var sendbutton = document.querySelector(".hidden_elem button[type='submit'][disabled]");
var ebonj = []
document.querySelector("a[data-tooltip-content='Choisissez une réponse type'],a[data-tooltip-content='Insert saved reply'],a[data-tooltip-content='Insérez une réponse enregistrée']").click()
setTimeout(function() {
document.body.querySelectorAll("h4").forEach(function(eall) {
if (eall.innerText && eall.innerText.startsWith("Bonjour#")) {
ebonj.push(eall)
}
})
var rebonj = ebonj[Math.floor(Math.random() * ebonj.length)]
rebonj.click()
setTimeout(function() {
sendbutton.click();
}, 1000);
}, 2000);
}
}, 2000);
setTimeout(goo, 7000);
}
window.goo = function() {
nlist = [].slice.call(document.querySelectorAll("div[role='presentation'] .timestamp:not(.already_checked)"))
goo();
}
window.onload=function(){
setInterval(window.goo, 60000);
setInterval(function() {
document.location.reload();
}, 30 * 1000 * 60)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment