langsung aja gan. nih scriptnya:
<?php
//Bot Comment+Like by RieqyNS13
set_time_limit(0);
class rieqyns13{
var $user_id;
var $token;
var $limit;
var $signature;
var $message;
var $status;
var $link;
var $status_id;
private $loop;
private $gender;
var $simi_cookie;
var $link_komen;
var $fls_komen;
var $video_komen;
var $simi;
var $like;
var $komen;
var $hitung_str;
var $jangan_dikomen;
var $img_komen;
var $url_graph;
var $post_waktu=false;
var $post_signature=false;
var $myfirstname;
var $post_urutan=false;
var $komen_id=null;
var $tag_user;
function graph($url, $data=null, $header=null){
$ch = curl_init();
if($data != null){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
if($header != null){
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
function get_url(){
if($this->user_id=="me")$this->url_graph = $this->graph("https://graph.facebook.com/me/home?fields=picture,story,message,from,id,type,comments.fields(message,from)&limit=".$this->limit."&access_token=".$this->token);
elseif(preg_match("/[.a-zA-Z0-9]w/i", $this->user_id))$this->url_graph = $this->graph("https://graph.facebook.com/".$this->user_id."/feed?fields=picture,story,message,from,id,type,comments.fields(message,from)&limit=".$this->limit."&access_token=".$this->token);
else return false;
}
function get_name(){
$url = $this->graph("https://graph.facebook.com/me?access_token=".$this->token);
$json = json_decode($url, true);
@$this->myfirstname = $json['first_name'];
}
function match($str){
if(preg_match("#[myname]#is", $str)) $str = str_ireplace("[myname]", $this->myfirstname, $str);
else $str = $str;
if(preg_match("#[target]#is", $str)) $str = str_ireplace("[target]", $this->gender.$this->target, $str);
else $str = $str;
return $str;
}
function match_simi($fls_komen, $status){
if(preg_match("#[simi]#is", $fls_komen))$fls_komen = str_ireplace("[simi]", $this->simsimi($status), $fls_komen);
return $fls_komen;
}
function like_and_komen(){
$json = json_decode($this->url_graph, true);
if(empty($json['data'])){
echo "[+]Pastikan token valid dan belum expired..n";
exit("keluar");
}
$data = $json['data'][$this->loop];
$cm_id = $data['id'];
if($this->like==true){
$data_l = array("method" => "POST",
"access_token" => $this->token);
$like = $this->graph("https://graph.facebook.com/".$cm_id."/likes", $data_l);
$json_d = json_decode($like, true);
if(!empty($json_d['error'])) $like = $json_d['error']['message'];
elseif(!empty($json_d['error'])) $like = $like;
echo "[+]ID: ".$cm_id."n[+]Like Status: ".$like."n";
}
if(!$this->komen)continue;
$user_id = $data['from']['id'];
if($this->tag_user)$user = "@[".$user_id.":1]";
else{
$user = explode(' ', $data['from']['name']);
$user = $user[0];
}
$gender_data = $this->graph("https://graph.facebook.com/".$user_id."?fields=gender");
$json_gender = json_decode($gender_data, true);
if(!empty($json_gender['gender'])){
$gender = $json_gender['gender'];
if($gender=="male"){
$male = array("mas ", "om ", "mbah ", "pak ", "agan ");
$this->gender = $male[array_rand($male)];
}elseif($gender=="female"){
$female = array("mbak ", "mbah ", "bu ", "dek ", "tante ");
$this->gender = $female[array_rand($female)];
}
}else $this->gender = "mas/mbak ";
$this->target = $user;
//////olah komentar////
if($this->cek($cm_id, $this->status_id)==false){
echo "ID status {$cm_id} sudah pernah dibotn";
}elseif($this->cek($cm_id, $this->status_id)==true){
if(in_array($user_id, $this->jangan_dikomen)==false){
if($this->post_urutan==false) $count = null;
else{
if(!empty($data['comments'])){
$data_c = $data['comments']['data'];
$urut = count($data_c)+1;
$count = count($data_c);
if($count>=3){
//$count = "n[+]3 orang yg komen duluan: nn[1]".$data_c[0]['from']['name']." => ".$data_c[0]['message']."n[2]".$data_c[1]['from']['name']." => ".$data_c[1]['message']."n[3]".$data_c[2]['from']['name']." => ".$data_c[2]['message']."n*ane urutan ke ".$urut."nn";
$count = "nKomen urutan ke-".$urut."n3 orang komen tercepat >.< : ".$data_c[0]['from']['name'].", ".$data_c[1]['from']['name'].", dan ".$data_c[2]['from']['name'];
}elseif($count==2){
//$count = "n[+]2 orang yg komen duluan: nn[1]".$data_c[0]['from']['name']." => ".$data_c[0]['message']."n[2]".$data_c[1]['from']['name']." => ".$data_c[1]['message']."n*ane urutan ke ".$urut."nn";
$count = "nKomen urutan ke-".$urut."n2 orang komen tercepat >.< : ".$data_c[0]['from']['name'].", dan ".$data_c[1]['from']['name'];
}elseif($count==1){
// $count = "n[+]1 orang yg komen duluan: nn[1]".$data_c[0]['from']['name']." => ".$data_c[0]['message']."n*ane urutan ke ".$urut."nn";
$count = "n:|] mau komen duluan malah udah keduluan ama kak ".$data_c[0]['from']['name']." >.< . jdi urutan ke-".$urut."n";
}else $count = null;
}elseif(empty($data['comments'])){
$count = "nn:|] Berhasil comment pertama di statusnya ".$this->gender.$this->target." 8| n";
}
}
/////////
if($this->post_waktu==true) $waktu = $this->waktu();
elseif($this->post_waktu==false) $waktu = null;
if($this->post_signature==true) $signature = "n".$this->signature;
elseif($this->post_signature==false) $signature = null;
if(!isset($data['type']))$type = null;
else $type = $data['type'];
if(isset($data['message'])){
$this->status = $data['message'];
if($this->simi==true){
$simi = $this->simsimi($this->status).$this->hitung_str($user, $this->status);
}elseif($this->simi==false){
if(is_array($this->fls_komen))$this->fls_komen=$this->fls_komen[array_rand($this->fls_komen)];
$fls_komen = $this->match($this->fls_komen);
$fls_komen = $this->match_simi($fls_komen, $this->status);
$simi = $fls_komen.$this->hitung_str($user, $this->status);
}
$this->message = "n".$simi;
}else{
$this->message = null;
}
if($type=="photo"){
if(is_array($this->img_komen))$this->img_komen=$this->img_komen[array_rand($this->img_komen)];
$img_komen = $this->match($this->img_komen);
$this->message .= "n".$img_komen;
}elseif($type=="link"){
if(is_array($this->link_komen))$this->link_komen=$this->link_komen[array_rand($this->link_komen)];
$link_komen = $this->match($this->link_komen);
$this->message.= "n".$link_komen;
}elseif($type=="video"){
if(is_array($this->video_komen))$this->video_komen=$this->video_komen[array_rand($this->video_komen)];
$video_komen = $this->match($this->video_komen);
$this->message.= "n".$video_komen;
}elseif($type==null){
if(is_array($this->fls_komen))$this->fls_komen=$this->fls_komen[array_rand($this->fls_komen)];
$fls_komen = $this->match($this->fls_komen);
$fls_komen = str_ireplace("[simi]", '', $fls_komen);
$this->message = $fls_komen;
}
/////////data message//////////////
$data_m = array("message" => $this->message."n".$count.$waktu.$signature,
"method" => "POST", "access_token" => $this->token);
////////////-----------------//////////////
$komen = $this->graph("https://graph.facebook.com/".$cm_id."/comments", $data_m);
$json_d = json_decode($komen, true);
if(!empty($json_d['error'])) $komen = $json_d['error']['message'];
elseif(!empty($json_d['id'])){
$komen_id = $json_d['id'];
$komen = "Sukses ->".$komen_id;
$this->save($this->status_id, $cm_id."n");
if($this->komen_id!=null)$this->save($this->komen_id, $komen_id."n");
}
echo $this->message.$waktu.$signature."n[+]Komen Status: ".$komen;
}else echo $user."(".$user_id.") user ini masuk dalam daftar jangan dikomen dan dilike";
}
//////////////////////////////////
}
function cek($id, $file){
if(!file_exists($file)){
$fp = fopen($file, "a");
fclose($fp);
}
$file = file($file);
foreach($file as $line){
$line = str_replace(array("n", "r", "rn"), "", $line);
if($id==$line) return false;
}
return true;
}
function jum_kata($str){
$data = null;
$str_r = str_replace(array("n", "r", "rn", " "), "", $str);
$uniq = array_unique(str_split($str_r));
foreach($uniq as $value){
$data .= "karakter ".$value." ada ".substr_count($str, $value)." buahn";
}
return $data;
}
function jum_spasi_dan_kalimat($str){
$str2 = trim($str);
$preg = preg_replace("/s+/", " ", $str2);
$exp = explode(" ", $preg);
$data = "jumlah kata = ".count($exp)."njumlah spasi = ".substr_count($str, " ")."n";
return $data;
}
function jum_huruf_perkata($str){
$data =null;
$str = trim($str);
$preg = preg_replace("/s+/", " ", $str);
$exp = explode(" ", $preg);
for($a=1; $a<=count($exp); $a++){
$data .= "jumlah karakter pada kata ke-".$a." = ".strlen($exp[$a-1])."n";
}
return $data;
}
function hitung_str($user, $str){
if($this->hitung_str==true && !empty($str)){
return "[+]Status dari ".$user." mengandung: n".$this->jum_kata($str).$this->jum_spasi_dan_kalimat($str).$this->jum_huruf_perkata($str);
}elseif($this->hitung_str==false){
return null;
}else return null;
}
function save($file, $str){
$fp = fopen($file, "a");
fwrite($fp, $str);
fclose($fp);
}
function simsimi($str){
$header = array("Cookie: ".trim($this->simi_cookie));
$mbuh = array("Ngomong apaan lu bray, gua gak ngerti :p", "Ngomong yg jelas bray, gak tw omongan lu gue :v", "Lu ngomong opo cuks, gua tampolin lu sampe begok -_-",
"Woi, ngomong yang jelas bray. gua robot bukan manusia :v", "Lu Homo ya, ngomongnya gak jelas amir -_-", "Tong otong, ngomong yang jelas tong", "Bhs.indo lu dpt brp sih ? Ngomongnya gak jelas amir -_-", "Kowe ngomong karo aku ? :p");
$url="http://www.simsimi.com/func/reqN?lc=id&ft=0.0&req=".urlencode($str);
$exec = $this->graph($url, null, $header);
$dec = json_decode($exec, true);
if(empty($dec)){
echo $dec;
$simi = " 👉 apa itu {$this->gender} ? ane gak tau. tolong ajarin ane";
return $simi;
}else{
if(!empty($dec['sentence_resp'])) $simi=$dec['sentence_resp'];
else{
echo $exec;
return "👉 gak ada infomasi :P";
}
if(strcmp($simi, "Simsimi tidak tahu perkataan itu. Tolong ajarkan.")==0)$preg=$mbuh[array_rand($mbuh)];
else $preg=preg_replace("/simsimi|simi|.simi|sim/is", " gue", $simi);
return " 👉 ".$preg;
}
}
function waktu(){
if(function_exists('date_default_timezone_set')) date_default_timezone_set("Asia/Jakarta");
$hari=date('w');
$tgl =date('d');
$bln =date('m');
$thn =date('Y');
$jam =date("H:i:s");
switch($hari){
case 0 : {$hari='Minggu';}break;
case 1 : {$hari='Senin';}break;
case 2 : {$hari='Selasa';}break;
case 3 : {$hari='Rabu';}break;
case 4 : {$hari='Kamis';}break;
case 5 : {$hari="Jum'at";}break;
case 6 : {$hari='Sabtu';}break;
default: {$hari='UnKnown';}break;
}
switch($bln){
case 1 : {$bln='Januari';}break;
case 2 : {$bln='Februari';}break;
case 3 : {$bln='Maret';}break;
case 4 : {$bln='April';}break;
case 5 : {$bln='Mei';}break;
case 6 : {$bln="Juni";}break;
case 7 : {$bln='Juli';}break;
case 8 : {$bln='Agustus';}break;
case 9 : {$bln='September';}break;
case 10 : {$bln='Oktober';}break;
case 11 : {$bln='November';}break;
case 12 : {$bln='Desember';}break;
default: {$bln='UnKnown';}break;
}
$waktu = "nn👿 ".$hari.", ".$tgl." ".$bln." ".$thn." ".$jam." 👽n";
return $waktu;
}
function waktu_stop($stop){
$detik = round($stop);
$menit = 0;
$jam = 0;
if($detik >= 60){
$menit = $detik/60;
$detik = $detik%60;
}
if($menit >= 60){
$jam = $menit/60;
$menit = $menit%60;
}
echo "n~ Selesai dalam waktu ".round($jam)." jam ".round($menit)." menit ".round($detik)." detik";
}
function bot(){
$this->get_url();
if($this->komen)$this->get_name();
$this->loop=0;
$start = time();
do{
echo "-------------------------[".$this->loop."]--------------------------n";
$this->like_and_komen();
echo "------------------------------------------------------n";
$this->loop++;
}while($this->loop<$this->limit);
$stop = time() - $start;
$this->waktu_stop($stop);
}
}
$bot = new rieqyns13;
//-------------settingan bot-------------------//
$token=file_get_contents("token.txt");
$bot->token = trim($token);
$bot->status_id = "tmp_fb2.txt";
$bot->simi=false; //jika true maka reply status akan menggunakan API simsimi, jika false reply status menggunakan variabel $bot->fls_komen
$bot->tag_user=false; //harus pke token BB
$bot->komen=true; //jika false maka likes status dinonaktifkan
$bot->like=true; //jika false maka comment status dinonaktifkan
$bot->post_waktu=false; //jika false maka post waktu dinonaktifkan
$bot->post_signature=true; //jika false maka post signature waktu dinonaktifkan
$bot->post_urutan=true; //jika false maka post urutan dinonaktifkan
/*untuk fls_komen
[myname] = nama depan boter
[target] = nama depan target
*/
$bot->fls_komen = array("[myname] mw numpang komen di statusnya [target] 8| [simi]", "Akhirnya [target] update statusnya :v [simi]"); //dieksekusi jika $bot->type=simi
$bot->img_komen = array("ngambarnya bagus tuh [target] :v :p", "nphotonya dpt dri mana tuh [target], dari google ya :v", "ngambar apaan tuh [target], kok kaya pernah liat :o");
$bot->link_komen = array("nlink apaan itu [target] :o", "nlinknya aman gak tuh [target] :v", "nwew, linkya boleh tak buka pa gak tuh [target]");
$bot->video_komen = array("nVideo apaan tuh [target] :o", "nHayo, video apaan tuh [target] :p", "nVideonya aman dibuka gak tuh [target] :o");
$bot->hitung_str=false; //ganti false jika ingin menonaktifkan fitur hitung karakter status
$bot->jangan_dikomen = array("666"); //id user yang jangan dikomen
$bot->limit=13; //maksimal status yang dapat digraph default 30
$bot->user_id = "rieqyns13"; //"me" klo mw ngebot status yang ada di beranda, atau isi dgn user id seperti 100003462417807 atau username teman jika hanya ingin ngebot di profil teman yg sesuai dgn user id atau usernamenya
$cookie=trim(file_get_contents("cookie_simi.txt"));
$bot->simi_cookie = $cookie; //cookie simsimi, bisa pke cookie yg ini ato klo mw pke cookie yg lain, pke live http header
$bot->signature = ":|] Bot Gay :|] "; //tambahan dibawah comment botnya
$bot->bot();
?>
taruh token di file dalam token.txt. jika kalian gak pke akses token permanen, mungkin kalian harus refresh token agar script di atas bisa work truss. liat script refresh tokennya di sini
di situs jga ada fitur comment pke respon simsimi. jika mau pake tuh fitur, simpan cookie simsimi di cookie_simi.txt. kalian mungkin juga butuh script refresh cookie simsimi di sini
salam Bot :p
0 Komentar untuk "Bot Comment/Like by RieqyNS13"