From 9314fba818c0d7951818fd13a2d9d26546c4bd94 Mon Sep 17 00:00:00 2001 From: JoshuaMicallefYBSU <91457812+JoshuaMicallefYBSU@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:12:34 +1000 Subject: [PATCH] DiscordJoinFix --- app/Http/Controllers/Community/DiscordController.php | 7 +++---- routes/web.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Community/DiscordController.php b/app/Http/Controllers/Community/DiscordController.php index 82503a3a..5f398f72 100644 --- a/app/Http/Controllers/Community/DiscordController.php +++ b/app/Http/Controllers/Community/DiscordController.php @@ -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() @@ -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']; @@ -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.'); } diff --git a/routes/web.php b/routes/web.php index 8f80732d..98efbfc1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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