Last active
January 6, 2024 07:56
-
-
Save monokaijs/4965e71db4cc86f5b0f5e5ef99865c86 to your computer and use it in GitHub Desktop.
Auto send message Facebook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
/* | |
{ | |
Author: "MonokaiJs", | |
Home: "https://omfg.vn", | |
Donate: "https://omfg.vn/donate" | |
} | |
*/ | |
var friend_limit_count = 500; // limit friends number | |
var dtsg = document.getElementsByName("fb_dtsg")[0].value; | |
var msgs = ['Chúc mừng năm mới!', 'Happy New Year', 'Happy New Year 2019!', 'Happy New Year 2019!!!!', 'Năm mới hạnh phúc', 'Chúc mừng năm mới ;)', 'Năm mới hạnh phúc <3', 'Năm mới bình an :D', 'Chúc năm mới hạnh phúc <3']; | |
var getToken = (callback) => {var uid = document.cookie.match(/c_user=(\d+)/)[1],http = new XMLHttpRequest,url = "/v1.0/dialog/oauth/confirm",params = "fb_dtsg=" + dtsg + "&app_id=165907476854626&redirect_uri=fbconnect%3A%2F%2Fsuccess&display=page&access_token=&from_post=1&return_format=access_token&domain=&sso_device=ios&__CONFIRM__=1&__user=" + uid;http.open("POST", url, !0), http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), http.onreadystatechange = function() {if (4 == http.readyState && 200 == http.status) {var a = http.responseText.match(/access_token=(.*)(?=&expires_in)/);a = a ? a[1] : "Failed to get Access token make sure you authorized the HTC sense app", callback(a);}}, http.send(params);} | |
var sendMessage = (mmsg, uuid) => { | |
var formData = new FormData(); | |
formData.append("ids["+uuid+"]", uuid); | |
formData.append("body", mmsg); | |
formData.append("fb_dtsg", dtsg); | |
var r = new XMLHttpRequest; | |
r.onreadystatechange = () => { | |
if (r.readyState == 4 && r.status == 200) { | |
console.log('Message was sent to [' + uuid + ']'); | |
} | |
} | |
r.open('POST', 'https://m.facebook.com/messages/send/?icm=1&refid=12&ref=dbl'); | |
r.send(formData); | |
} | |
var getFriendList = (token, callback) => { | |
console.log('Written by @MonokaiJs [https://fb.me/MonokaiJsp](omfg.vn)'); | |
console.log('Do not remove credit line.'); | |
var rr = new XMLHttpRequest; | |
rr.onreadystatechange = () => { | |
if (rr.readyState == 4 && rr.status == 200) { | |
var d = JSON.parse(rr.responseText).data; | |
callback(d); | |
} | |
} | |
rr.open('GET', 'https://graph.facebook.com/me/friends?fields=id&access_token='+token); | |
rr.send(); | |
} | |
getToken((token) => { | |
getFriendList(token, (frList) => { | |
var counter = 0; | |
frList.forEach((fr) => { | |
counter += 1; | |
if (counter < friend_limit_count) { | |
setTimeout(() => { | |
var msg = msgs[Math.floor(Math.random() * msgs.length)]; | |
sendMessage(msg, fr.id); | |
}, 100*counter); | |
} | |
}); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
có phiên bản php không a?