From c6fadd4a002f9d9938581b8508770c9e718f4b70 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 21 Dec 2019 15:52:57 -0500 Subject: [PATCH] Added support to re-register to add a discord uuid + With plugin support, users can be created without discord uuids + When a player wants to use geoffrey in discord, they just need to register in discord --- GeoffreyApp/api/commands.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GeoffreyApp/api/commands.py b/GeoffreyApp/api/commands.py index 2782cea..70659a6 100644 --- a/GeoffreyApp/api/commands.py +++ b/GeoffreyApp/api/commands.py @@ -151,8 +151,14 @@ def register(player_name, discord_uuid): mc_uuid = grab_UUID(player_name) try: - get_player(mc_uuid=mc_uuid) - raise PlayerInDBError + player = get_player(mc_uuid=mc_uuid) + + if len(discord_uuid) != 0 and len(player.discord_uuid) == 0: + player.discord_uuid = discord_uuid + player.save() + return player + else: + raise PlayerInDBError except PlayerNotFound: player = Player.objects.create(name=player_name, mc_uuid=mc_uuid, discord_uuid=discord_uuid) player.save()