Skip to content

Commit

Permalink
Merge pull request #361 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
Another Fix
  • Loading branch information
JoshuaMicallefYBSU authored Oct 20, 2024
2 parents 51b90a1 + 6d6c3a2 commit 3f89403
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function schedule(Schedule $schedule)
$schedule->job(new ProcessSessionLogging())->everyMinute();

//Inactivity checks
$schedule->job(new DiscordAccountCheck())->dailyAt('10:30');
$schedule->job(new DiscordAccountCheck())->dailyAt('10:40');

//Inactivity checks
$schedule->job(new ProcessRosterInactivity())->daily();
Expand Down
15 changes: 9 additions & 6 deletions app/Jobs/DiscordAccountCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ public function handle()
$discordRoleIds = [
'guest' => 482835389640343562,
'training' => 482824058141016075,
'gander_certified' => 482819739996127259,
'shanwick_certified' => 482819739996127259,
'certified' => 482819739996127259,
'gander_certified' => 1297507926222573568,
'shanwick_certified' => 1297508027280396349,
'supervisor' => 720502070683369563,
];

Expand All @@ -128,6 +129,7 @@ public function handle()
switch ($rosterProfile->certification) {
case 'certified':
array_push($rolesToAdd, $discordRoleIds['certified']);
array_push($rolesToAdd, $discordRoleIds['gander_certified']);
break;
case 'training':
array_push($rolesToAdd, $discordRoleIds['training']);
Expand All @@ -139,6 +141,7 @@ public function handle()
$shanwickRoster = ShanwickController::where('controller_cid', $user->id)->first();
if ($shanwickRoster) {
array_push($rolesToAdd, $discordRoleIds['certified']);
array_push($rolesToAdd, $discordRoleIds['shanwick_certified']);
}

//Supervisor?
Expand Down Expand Up @@ -190,10 +193,10 @@ public function handle()
foreach($discord_uids as $discord_uid){
$accounts_not_linked++; //records that Account Not Linked Role Assigned

// sleep(3);
sleep(3);

// // add role
// $discord->getClient()->put('guilds/'.env('DISCORD_GUILD_ID').'/members/'.$discord_uid.'/roles/1297422968472997908');
// add role
$discord->getClient()->put('guilds/'.env('DISCORD_GUILD_ID').'/members/'.$discord_uid.'/roles/1297422968472997908');
}


Expand All @@ -218,7 +221,7 @@ public function handle()
$update_content .= "\n- Script Time: " . $start_time->diffForHumans($end_time, ['parts' => 2, 'short' => true, 'syntax' => Carbon::DIFF_ABSOLUTE]) . ".";


$discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'WEEKLY: Discord User Update', $update_content);
$discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'DAILY: Discord User Update', $update_content);
}

}

0 comments on commit 3f89403

Please sign in to comment.