authid= $authid; } /** * Execute the job. */ public function handle(): void { $API = new APIController(); $user = Account::find($this->authid); try{ //On check si le compte est ok $API->check($user); //On check les notifs $API->unread($user); if (Cache::has('news')) { $news = Cache::get('news'); }else{ $news = $API->newstweet($user); } shuffle($news); $nb = rand(1,3); 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(); // L'URL des deux liens $url = 'https://myx.ovh/accounts/'.$user->id; $keyboard = [ 'inline_keyboard' => [ [ ['text' => 'Cliquez ici pour plus d\'infos', 'url' => $url] ] ] ]; // Convertir le tableau de clavier en JSON $keyboardJson = json_encode($keyboard); // Envoyer le message avec les deux boutons Http::get('https://api.telegram.org/bot6784810105:AAEq3emnkRwdyvCLC-iqdIjVJ2Ke6HwwGjg/sendMessage', [ 'chat_id' => '1970698501', 'text' => $text, 'reply_markup' => $keyboardJson ]); } } }