<?php
set_time_limit(0);
class rieqyns13{
public $consumer_key;
public $consumer_secret;
public $access_token;
public $access_token_secret;
public $_count;
public $send_msg;
public $save_id;
function con(){
require_once("lib/twitteroauth.php");
$con = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $this->access_token, $this->access_token_secret);
return $con;
}
function simpan($id){
$fp = fopen($this->save_id, "a") or die("error cok");
fwrite($fp, $id);
fclose($fp);
}
function check($id){
if(!file_exists($this->save_id)){
$fp = fopen($this->save_id, "a");
fclose($fp);
}
$file = file($this->save_id);
$file = str_replace(array("\n", "\r", "\r\n"), "", $file);
if(in_array($id, $file))return false;
else return true;
}
function gay(){
echo "[+]Proses.....\n";
$con = $this->con();
$mbuh = $con->get("followers/ids", array("cursor" => "-1", "count"=>$this->_count));
foreach($mbuh->ids as $ids){
$gay = $con->get("friendships/show", array("source_id"=>$ids, "target_screen_name"=>"RieqyNS13"));
if($gay->relationship->source->followed_by==false && $gay->relationship->target->following==false){
if($this->check($ids)){
echo "[+]ID {$ids} belum ada di daftar, mulai follow\n";
$info = $con->get("users/show", array("user_id"=>$ids));
$screen_name = $info->screen_name;
$name = $info->name;
$foll = $con->post("friendships/create", array("user_id"=>$ids, "follow"=>true));
echo "[~]Berhasil follow id ".$ids."({$screen_name})\n";
if($this->send_msg){
echo "[~]Kirim mention aktif\n";
$post = $con->post("statuses/update", array("status" => "@{$screen_name} Thanks for your following. I've been following you back \n #BotRieqyNS13"));
if(!empty($post->text)){
echo "[~]Sukses send mention\n";
}else{
echo "[~]Error: ".$post->errors[0]->message."\n";
}
}
}else echo "[+]ID {$ids} sudah ada di daftar\n";
$this->simpan($ids."\n");
}else{
echo "[+]ID {$ids} sudah difollow\n";
}
}
}
}
$bot = new rieqyns13;
$bot->_count=5; //ojo akeh2 cok
$bot->save_id="follow.id";
$bot->send_msg=true;
$bot->consumer_key="";
$bot->consumer_secret="";
$bot->access_token="";
$bot->access_token_secret="";
$bot->gay();
?>
Comments