Fix data not showing up for live map (#1223)

* Fix data not showing up for live map

* StyleCI fixes
This commit is contained in:
Nabeel S
2021-06-04 16:57:27 -04:00
committed by GitHub
parent 48cada2053
commit 96d33c11c8
15 changed files with 92 additions and 549 deletions

35
app/Support/Discord.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
namespace App\Support;
use Illuminate\Support\Facades\Log;
class Discord
{
/**
* Get a user's private channel ID from Discord
*
* @param string $discord_id
*/
public static function getPrivateChannelId(string $discord_id)
{
/** @var HttpClient $httpClient */
$httpClient = app(HttpClient::class);
try {
$response = $httpClient->post(
'https://discord.com/api/users/@me/channels',
[
'recipient_id' => $discord_id,
]
);
dd($response);
return $response->id;
} catch (\Exception $ex) {
dd($ex);
Log::error('Could not get private channel id for '.$discord_id.';'.$ex->getMessage());
return '';
}
}
}