diff --git a/app/Console/Commands/runclonesaver.php b/app/Console/Commands/runclonesaver.php index aae70b5cc..67eac982d 100644 --- a/app/Console/Commands/runclonesaver.php +++ b/app/Console/Commands/runclonesaver.php @@ -12,6 +12,9 @@ use App\Library\Esi\Mail; use App\Library\Clones\CloneSaver; use App\Models\Character\CharacterClone; +use App\Models\Mail\EveMail; +use App\Models\Esi\EsiScope; +use App\Models\Esi\EsiToken; class RunCloneSaver extends Command { @@ -59,6 +62,24 @@ class RunCloneSaver extends Command $task->SetStopStatus(); } + private function CheckEsiScope() { + //Check the esi scope. + //If the esi scopes are not present then send a mail + $mail = new EveMail; + $mail->sender = 93738489; + $mail->subject = 'Incorrect ESI Scope(s)'; + $mail->body = "You don't have the correct ESI Scope(s) registered.
" . + "Please register the following scopes:
" . + $scopes . + "Sincerely,
" . + "Amund Risalo"; + $mail->recipient = (int)$charId; + $mail->recipient_type = 'character'; + $mail->save(); + + SendEveMail::dispatch($mail)->delay(Carbon::now()->addMinutes(2)); + } + private function CloneSaverMail() { //Setup time frame job has been sent so we don't send too many mails diff --git a/app/Library/Esi/Esi.php b/app/Library/Esi/Esi.php index ece005ddb..c4bde463e 100644 --- a/app/Library/Esi/Esi.php +++ b/app/Library/Esi/Esi.php @@ -5,6 +5,7 @@ namespace App\Library\Esi; use DB; use App\Models\Esi\EsiScope; +use App\Jobs\SendEveMail; use Seat\Eseye\Cache\NullCache; use Seat\Eseye\Configuration; @@ -34,6 +35,16 @@ class Esi { } } + $mail = new EveMail; + $mail->sender = 93738489; + $mail->subject = 'W4RP Services - Incorrect ESI Scope'; + $mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope; + $mail->recipient = (int)$charId; + $mail->recipient_type = 'character'; + $mail->save(); + + SendEveMail::dispatch($mail)->delay(Carbon::now()->addSeconds(5)); + return false; }