Ajout de l'affichage des account et contest dans l'app

This commit is contained in:
hugol
2024-11-18 18:25:41 +01:00
parent e79d64eb24
commit aab9af6372
12 changed files with 455 additions and 92 deletions

View File

@@ -12,6 +12,8 @@ class ProcessNews implements ShouldQueue
{
use Queueable;
public $timeout = 300;
private $authid;
/**
@@ -32,6 +34,11 @@ class ProcessNews implements ShouldQueue
$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')) {
@@ -50,14 +57,14 @@ class ProcessNews implements ShouldQueue
foreach ($selectedArticles as $article) {
$tweetid = $article['conversation_id_str'];
$API->retweet($user, $tweetid);
sleep(15);
sleep(30);
}
}
}catch (Exception $exception){
$text = "Le compte Twitter " . $user->name . " : " . $exception->getMessage();
// L'URL des deux liens
$url = 'https://myx.ovh/nova/resources/accounts/'.$user->id;
$url = 'https://myx.ovh/accounts/'.$user->id;
$keyboard = [
'inline_keyboard' => [
@@ -78,4 +85,4 @@ class ProcessNews implements ShouldQueue
]);
}
}
}
}

View File

@@ -16,7 +16,7 @@ class ProcessTweet implements ShouldQueue
{
use Queueable;
public $timeout = 90;
public $timeout = 900;
public $tries = 1;
private $id;
@@ -54,10 +54,11 @@ class ProcessTweet implements ShouldQueue
$hashtags = $this->getHashtags($text);
$follows = $this->getFollows($text);
$API = new APIController();
//On check si le compte est ok
$API->check($user);
//On check les notifs
$API->unread($user);
@@ -71,7 +72,6 @@ class ProcessTweet implements ShouldQueue
//On reply
$API->reply($user, $contest->tweetid, $retweet);
sleep(15);
}elseif(isset($tweetcomment) && isset($tags)) {
$comments = config('twitter.sentence_for_tag');
@@ -80,7 +80,6 @@ class ProcessTweet implements ShouldQueue
//On reply
$API->reply($user, $contest->tweetid, $retweet);
sleep(15);
}elseif(isset($tweetspecial)){
@@ -88,7 +87,6 @@ class ProcessTweet implements ShouldQueue
//On reply
$API->reply($user, $contest->tweetid, $retweet);
sleep(15);
}elseif(isset($tweetcomment)){
@@ -98,7 +96,6 @@ class ProcessTweet implements ShouldQueue
//On reply
$API->reply($user, $contest->tweetid, $retweet);
sleep(15);
}elseif(isset($tags)){
@@ -106,22 +103,13 @@ class ProcessTweet implements ShouldQueue
//On reply
$API->reply($user, $contest->tweetid, $retweet);
sleep(15);
}
//On follow le créateur
$API->follow($user, $contest->screen);
sleep(15);
if(isset($follows)){
foreach ($follows as $follow){
//On folow les personnes demandées
$API->follow($user, $follow);
sleep(5);
}
}
//On follow
$API->follow($user, $contest->tweetid);
sleep(15);
//On like si besoin
preg_match("/LIKE/i", $text, $like);
@@ -161,7 +149,7 @@ class ProcessTweet implements ShouldQueue
$text = "Le compte Twitter " . $user->name . " : " . $exception->getMessage();
// L'URL des deux liens
$url = 'https://myx.ovh/nova/resources/accounts/'.$user->id;
$url = 'https://myx.ovh/accounts/'.$user->id;
$keyboard = [
'inline_keyboard' => [
@@ -258,27 +246,31 @@ class ProcessTweet implements ShouldQueue
//On recherche si ça demande un tag
$word_tags = config('twitter.word_tag');
$combined_regex = implode('|', array_map('preg_quote', $word_tags, array_fill(0, count($word_tags), '/')));
$tags = collect(config('twitter.tags'));
if (preg_match('/' . $combined_regex . '/i', $text, $matches)) {
//On recherche si ça demande 1 tag
$one_people_lists = config('twitter.one_people_list');
$combined_regex = implode('|', array_map('preg_quote', $one_people_lists, array_fill(0, count($one_people_lists), '/')));
if (preg_match('/' . $combined_regex . '/i', $text, $matches)) {
return '@chauchettes';
$values = $tags->random(1);
return '@' . $values[0];
}
//On recherche si ça demande 2 tags
$two_people_lists = config('twitter.two_people_list');
$combined_regex = implode('|', array_map('preg_quote', $two_people_lists, array_fill(0, count($two_people_lists), '/')));
if (preg_match('/' . $combined_regex . '/i', $text, $matches)) {
return '@chauchettes @totorunior';
$values = $tags->random(2);
return '@' . $values[0]. ' @' . $values[1];
}
//On recherche si ça demande 3 tags ou plus
$three_or_more_people_lists = config('twitter.three_or_more_people_list');
$combined_regex = implode('|', array_map('preg_quote', $three_or_more_people_lists, array_fill(0, count($three_or_more_people_lists), '/')));
if (preg_match('/' . $combined_regex . '/i', $text, $matches)) {
return '@chauchettes @totorunior @crakotte84';
$values = $tags->random(3);
return '@' . $values[0]. ' @' . $values[1]. ' @' . $values[2];
}
}
}