Correction des différents bugs
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Foundation\Queue\Queueable;
|
||||
use App\Http\Controllers\APIController;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ProcessNews implements ShouldQueue
|
||||
{
|
||||
@@ -49,17 +50,14 @@ class ProcessNews implements ShouldQueue
|
||||
|
||||
shuffle($news);
|
||||
|
||||
$nb = rand(1,3);
|
||||
$randomKey = array_rand($news);
|
||||
|
||||
$article = $news[$randomKey];
|
||||
|
||||
$tweetid = $article['conversation_id_str'];
|
||||
$API->retweet($user, $tweetid);
|
||||
sleep(15);
|
||||
|
||||
if (count($news) >= $nb) {
|
||||
$selectedArticles = array_slice($news, 0, $nb);
|
||||
|
||||
foreach ($selectedArticles as $article) {
|
||||
$tweetid = $article['conversation_id_str'];
|
||||
$API->retweet($user, $tweetid);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
}catch (Exception $exception){
|
||||
$text = "Le compte Twitter " . $user->name . " : " . $exception->getMessage();
|
||||
|
||||
@@ -79,7 +77,7 @@ class ProcessNews implements ShouldQueue
|
||||
|
||||
// Envoyer le message avec les deux boutons
|
||||
Http::get('https://api.telegram.org/bot6784810105:AAEq3emnkRwdyvCLC-iqdIjVJ2Ke6HwwGjg/sendMessage', [
|
||||
'chat_id' => '1970698501',
|
||||
'chat_id' => '1970698501', // Remplacez par votre chat_id
|
||||
'text' => $text,
|
||||
'reply_markup' => $keyboardJson
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user