Skip to content

Commit

Permalink
Merge pull request #353 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
DiscordJoinFix
  • Loading branch information
JoshuaMicallefYBSU authored Oct 17, 2024
2 parents ea7694b + 9314fba commit 311d80d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions app/Http/Controllers/Community/DiscordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,10 @@ public function linkCallbackDiscord(Request $request)
//Edit user
$user->discord_user_id = $discord_user['id'];
$user->discord_username = $discord_user['username'];
// $user->member_of_czqo = true;
$user->discord_avatar = $discord_user['avatar'] ? 'https://cdn.discordapp.com/avatars/'.$discord_user['id'].'/'.$discord_user['avatar'].'.png' : null;
$user->save();

return redirect()->route('my.index')->with('success', 'Linked with account '.$discord_user['username'].'!');
return redirect()->route('my.index')->with('success', 'Linked with account '.$discord_user['username'].'! Please join our Discord!');
}

public function joinRedirectDiscord()
Expand Down Expand Up @@ -257,7 +256,7 @@ public function joinCallbackDiscord(Request $request)
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
} catch (ClientException $e) {
return redirect()->route('my.index')->with('error-modal', $e->getMessage());
return redirect()->route('my.index')->with('error-modal', $e->getMessage().'... Unable to get Discord Authorisation Code');
}

$access_token = json_decode($response->getBody(), true)['access_token'];
Expand All @@ -279,7 +278,7 @@ public function joinCallbackDiscord(Request $request)
]
);
} catch (ClientException $e) {
return redirect()->route('my.index')->with('error-modal', $e->getMessage());
return redirect()->route('my.index')->with('error-modal', $e->getMessage().'.... Unable to update User Details.');
}


Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
// Discord shortcut
Route::get('/discord', [DiscordController::class, 'joinShortcut']);
Route::get('/discord/function-test', [DiscordTestController::class, 'Job']);
Route::get('/discord/function-test2', [DiscordTestController::class, 'Job2']);
// Route::get('/discord/function-test2', [DiscordTestController::class, 'Job2']);
Route::post('/discord/bot-webhook', [DiscordController::class, 'handelDiscordCommand']);

// Public news articles
Expand Down

0 comments on commit 311d80d

Please sign in to comment.