Skip to content

Instantly share code, notes, and snippets.

@ThomazPom
Created May 8, 2021 10:36
Show Gist options
  • Save ThomazPom/1f88e4e42df88a812a2ebd642e1141a1 to your computer and use it in GitHub Desktop.
Save ThomazPom/1f88e4e42df88a812a2ebd642e1141a1 to your computer and use it in GitHub Desktop.
Auto answer on facebook page inbox
// ==UserScript==
// @name FAQ AutoAnswer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @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
|| [...document.querySelectorAll("button")].filter(x=>x.innerText=="Envoyer")[0]
).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