Skip to content

Commit

Permalink
Merge pull request #303 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
Joshua branch
  • Loading branch information
JoshuaMicallefYBSU authored Aug 18, 2024
2 parents 14dee3b + 0b99675 commit f09e010
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function schedule(Schedule $schedule)
$schedule->job(new ProcessSessionReminders())->daily();

// Check Training Threads Status (Once per week)
$schedule->job(new DiscordTrainingUpdates())->weeklyOn(7, '17:45');
$schedule->job(new DiscordTrainingUpdates())->weeklyOn(7, '18:00');

// Discord role updating
//$schedule->job(new UpdateDiscordUserRoles)->twiceDaily(6, 18);
Expand Down
10 changes: 8 additions & 2 deletions app/Jobs/DiscordTrainingUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ public function handle()
}

// See if CID is still a student
$student = Student::where('user_id', $cid)->first();
$student = Student::where('user_id', $cid)->where('current', true)->first();

if($student !== null){

$counter++;

// Thread should be active, so lets activate it.
$discord = new DiscordClient();
$data = $discord->getClient()->patch('channels/'.$thread['id'], [
Expand Down Expand Up @@ -88,6 +91,8 @@ public function handle()
$response = $discord->getClient()->get('guilds/'.env('DISCORD_GUILD_ID').'/threads/active');
$results = json_decode($response->getBody(), true);

dd($results);

foreach ($results['threads'] as $thread) {

// Get the ID of the Active Training Thread
Expand All @@ -97,7 +102,8 @@ public function handle()
$cid = null;
}

$student = Student::where('user_id', $cid)->first();
// See if user is still a student
$student = Student::where('user_id', $cid)->where('current', true)->first();

// Check Lable is 'In Progress' or 'Ready For Pick-Up'
if($student->hasLabel('In Progress') || $student->hasLabel('Ready For Pick-Up')){
Expand Down

0 comments on commit f09e010

Please sign in to comment.