|
|
@ -8,6 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; |
|
|
|
use Log; |
|
|
|
use Twitter; |
|
|
|
use App\Tweet; |
|
|
|
use App\Events\ScoreUpdatedEvent; |
|
|
|
|
|
|
|
class TweetAcceptedListener implements ShouldQueue |
|
|
|
{ |
|
|
@ -42,7 +43,11 @@ class TweetAcceptedListener implements ShouldQueue |
|
|
|
'attachment_url' => 'https://twitter.com/'.$tweet->player->twitter.'/status/'.$tweet->tweet_id, |
|
|
|
'status' => $text |
|
|
|
]; |
|
|
|
Twitter::postTweet($params); |
|
|
|
try { |
|
|
|
Twitter::postTweet($params); |
|
|
|
} catch(\Exception $e) { |
|
|
|
Log::error($e->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Tweet about bonus points when a team visits a TC nobody else has been to
|
|
|
@ -61,10 +66,19 @@ class TweetAcceptedListener implements ShouldQueue |
|
|
|
'attachment_url' => 'https://twitter.com/'.$tweet->player->twitter.'/status/'.$tweet->tweet_id, |
|
|
|
'status' => $text |
|
|
|
]; |
|
|
|
Twitter::postTweet($params); |
|
|
|
try { |
|
|
|
Twitter::postTweet($params); |
|
|
|
} catch(\Exception $e) { |
|
|
|
Log::error($e->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Broadcast this team's current score
|
|
|
|
$score = $tweet->mission->score($tweet->team); |
|
|
|
$teamScore = $tweet->team->total_score(); |
|
|
|
event(new ScoreUpdatedEvent($tweet->team, $tweet->mission, $score, $newMissionStatus, $teamScore)); |
|
|
|
|
|
|
|
} |
|
|
|
} |