Khoảng 2 tháng rồi mình chưa viết bài gì . Nay mình dạo chơi thì tìm được cái code comment kèm sticker này . Mặc dù bot comment sticker đã xuất hiện khá lâu rồi . Nhưng mình thấy cái code này rất ok , dùng cá nhân rất tuyệt nên quyết định mang về chia sẻ cho các bạn trải nghiệm .
- Các bạn nên chú ý việc giới hạn cmt sticker nhé , tránh bị block tính năng
Ngoài ra mình chia sẻ thêm cho các bạn tổng hợp các id sticker để các bạn đi comment nhé :
Code này chỉ gồm một file php duy nhất :
Cách sử dụng được ghi chú rõ ràng trong file nên các bạn có thể tự đọc và làm theo nhé
<?php
/* -------------- BMN2312 -------------- */
set_time_limit(0);
error_reporting(0);
//Nhập token full quyền
$token = '';
//Giới hạn quét bài post cho mỗi lần duyệt feed
$limit = '10';
//Lấy danh sách friends
$friends = json_decode(request('https://graph.facebook.com/me?fields=friends&access_token='.$token.'&limit=5000'), true);
$afriends = $friends['friends']['data'];
//Lấy id bài đăng newfeed
$feed = json_decode(request('https://graph.facebook.com/me/home?fields=id,from&access_token='.$token.'&limit='.$limit), true);
$afeeds = $feed['data'];
//Lấy nội dung file log
$logpost= file_get_contents('logSTICKERS.txt');
//Tách lấy PostID & UserID
for ($i=0; $i<count($afeeds); $i++) {
$postid = $afeeds[$i]['id'];
$userid = $afeeds[$i]['from']['id'];
for ($j=0; $j<count($afriends); $j++) {
$react = array('LOVE','HAHA','WOW');
$type = $react[rand(0, count($react)-1)];
//Random stickers
$stickers= array('1151363191550698', '1151367911550226', '114314595829815', '131715304089744',);
$mess=$stickers[rand(0,count($stickers)-1)];
//Random emoticon
$emo=array (
'?','?','?','','?','?','?','?','?','?','?','?','?','?','?','?','?','☺','?','','?','?','?','?','?','?','?','?','?','','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','☝','?','?','✌','','?','','','?','✋','?','?','?','✊','?','','','','?','?','','?','','?','?','?','?','','?','?','','?','?','?','','','','?','?','?','?','?','?','?','?','?','?','?','?','','?','?','?','?','','?','?','?','?','?','?','?','','?','','?','?','?','?','?','','','','?','?','?','','?','?','?','?','?','?','','?','','?','?','?','','?','?','?','?','?','?','?','?','✅','✔','☑','??',
);
$emoticon=$emo[rand(0,count($emo)-1)];
//Tag tên
$tagged_name = ' @['.$userid.':1] ';
//Random comments
$text = array(
'
? '.$tagged_name.' ? ROBOT tự động trả lời bình luận, Chúc bạn một ngày tốt lành '.$emoticon.''.$emoticon.'
',
'
Xin chào, '.$tagged_name.'
Bạn có biết ???
Nghĩa•Vn Bot thả thính tốc độ số 1 tại VN hiện nay đó' . $emoticon . '
',
'
HêLô '.$tagged_name.' ' . $emoticon . '
Trong 30 triệu người dùng Facebook tại Việt Nam này
Rất may mắn khi hôm nay mình gặp được bạn :*
À thôi đéo có gì đâu !!! Mình PR cái website Nghĩa•Vn thôi.
Bot thả thính củ lồn nhất hiện nay đó :))
',
'
Rảnh share cho chúng mày cái API get link drive nè
Tiện cmt tao giới thiệu cho chúng mày biết. Tao là #BOT của thằng Nghĩa Mặt Lồn nhé ' . $emoticon . '
À Link API nè: Nghĩa•Vn/api/getdrive.php
',
'
Rảnh nữa nên share cho chúng bạn con API SimSimi đang hoạt động bình thường....
.
.
.
.
.
.
.
Có cái lồn ý !!! Thả thính đấy ngu ạ !!! Tất nhiên là lại PR Nghĩa•Vn rồi ' . $emoticon . '
',
'
Bạn gì đó ơi !!! ' . $emoticon . '
Bạn có biết ???
Website Nghĩa•Vn bot thả thính hàng đầu VN đó :D
Không tin đúng không
thử vào biết liền à <3
'
);
$comments = $text[rand(0,count($text)-1)];
//Check file log nếu không có ID POST sẽ thực hiện post LIKE
if (strpos($logpost, $postid) === FALSE) {
request('https://graph.facebook.com/'.$postid.'/reactions?type='.$type.'&method=post&access_token='.$token); //reactions
request('https://graph.facebook.com/'.$postid.'/comments?message='.urlencode($comments).'&attachment_id='.$mess.'&access_token='.$token.'&method=POST'); //comments
$luulog = fopen('logSTICKERS.txt', 'a');
fwrite($luulog, $postid . "\n");
fclose($luulog);
}
}
}
function request($url)
{
if (!filter_var($url, FILTER_VALIDATE_URL)) {
return FALSE;
}
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HEADER => FALSE,
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_ENCODING => '',
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36',
CURLOPT_AUTOREFERER => TRUE,
CURLOPT_CONNECTTIMEOUT => 15,
CURLOPT_TIMEOUT => 15,
CURLOPT_MAXREDIRS => 5,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => 0
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
unset($options);
return $http_code === 200 ? $response : FALSE;
}
?>
BÌNH LUẬN