From: Daniel Karbach Date: Thu, 8 Jun 2023 15:00:24 +0000 (+0200) Subject: some discord discriminator stuff X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=ff1f7c9fc9660ec838fb626cf6543201531020bb;p=alttp.git some discord discriminator stuff --- diff --git a/app/Console/Commands/SyncSpeedGaming.php b/app/Console/Commands/SyncSpeedGaming.php index 43afaa1..d7f9a63 100644 --- a/app/Console/Commands/SyncSpeedGaming.php +++ b/app/Console/Commands/SyncSpeedGaming.php @@ -317,10 +317,14 @@ class SyncSpeedGaming extends Command { } if (!empty($player['discordTag'])) { $tag = explode('#', $player['discordTag']); - $user = User::firstWhere([ - ['username', 'LIKE', $tag[0]], - ['discriminator', '=', $tag[1]], - ]); + $user = count($tag) < 2 || $tag[1] == '0' + ? User::firstWhere([ + ['username', 'LIKE', $tag[0]], + ]) + : User::firstWhere([ + ['username', 'LIKE', $tag[0]], + ['discriminator', '=', $tag[1]], + ]); if ($user) return $user; } return null; diff --git a/resources/js/components/users/Box.js b/resources/js/components/users/Box.js index 70006cb..fd5814f 100644 --- a/resources/js/components/users/Box.js +++ b/resources/js/components/users/Box.js @@ -17,7 +17,7 @@ const Box = ({ discriminator, noLink, user }) => { const content = <> {discriminator || !user.nickname ? user.username : user.nickname} - {discriminator ? + {discriminator && user.discriminator ? {'#'} {user.discriminator}