From 56b0b9ee680ecaad5d14db9f43cb16faaa1269ac Mon Sep 17 00:00:00 2001 From: JoshuaMicallefYBSU <91457812+JoshuaMicallefYBSU@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:16:58 +1000 Subject: [PATCH] Update DiscordController.php --- .../Controllers/Community/DiscordController.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Community/DiscordController.php b/app/Http/Controllers/Community/DiscordController.php index 5f398f72..3880da57 100644 --- a/app/Http/Controllers/Community/DiscordController.php +++ b/app/Http/Controllers/Community/DiscordController.php @@ -243,7 +243,7 @@ public function joinCallbackDiscord(Request $request) //Get access token using returned code $http = new Client(); - try { + // try { $response = $http->post('https://discord.com/api/v10/oauth2/token', [ 'form_params' => [ 'client_id' => env('DISCORD_CLIENT_ID'), @@ -255,14 +255,15 @@ 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().'... Unable to get Discord Authorisation Code'); - } + // } catch (ClientException $e) { + // 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']; + //Make em join Discord - try { + // try { $response = (new Client()) ->put( 'https://discord.com/api/v10/guilds/'.env('DISCORD_GUILD_ID').'/members/'.$user->discord_user_id, @@ -277,9 +278,9 @@ public function joinCallbackDiscord(Request $request) ] ] ); - } catch (ClientException $e) { - return redirect()->route('my.index')->with('error-modal', $e->getMessage().'.... Unable to update User Details.'); - } + // } catch (ClientException $e) { + // return redirect()->route('my.index')->with('error-modal', $e->getMessage().'.... Unable to update User Details.'); + // } //DM them