]> git.localhorst.tv Git - alttp.git/commitdiff
some discord discriminator stuff
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 8 Jun 2023 15:00:24 +0000 (17:00 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 8 Jun 2023 15:00:24 +0000 (17:00 +0200)
app/Console/Commands/SyncSpeedGaming.php
resources/js/components/users/Box.js

index 43afaa1b647f571e631818999385c0d7ec6d3c31..d7f9a63653d9a9b25f7f610861ecdddcc82dfe5c 100644 (file)
@@ -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;
index 70006cb13f2998df557130cbb0336efd7b49f597..fd5814f6216896baa4dcdda3d7ee784c394b917d 100644 (file)
@@ -17,7 +17,7 @@ const Box = ({ discriminator, noLink, user }) => {
        const content = <>
                <img alt="" src={getAvatarUrl(user)} />
                <span>{discriminator || !user.nickname ? user.username : user.nickname}</span>
-               {discriminator ?
+               {discriminator && user.discriminator ?
                        <span className="text-muted">
                                {'#'}
                                {user.discriminator}