Correction des différents bugs

This commit is contained in:
2024-11-27 16:30:59 +01:00
parent 780798ff25
commit cda2104b11
25 changed files with 1096 additions and 334 deletions

View File

@@ -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
]);