From 1aa12e88acf83b78113dab4f2cbd7d371ea21c24 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 13 Feb 2024 18:28:06 -0500 Subject: [PATCH] fix(aurora): fixed unknown user in history command --- aurora/utilities/utils.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index 9c78b9d..33b3b4c 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -152,16 +152,24 @@ async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict: user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"} else: - user = client.get_user(int(user_id)) + try: + user = client.get_user(int(user_id)) + if user is None: + user = await client.fetch_user(int(user_id)) - if user: user_dict = { "id": user.id, "name": user.name, "discriminator": user.discriminator, } - else: - user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"} + + except NotFound: + user_dict = { + "id": user_id, + "name": "Deleted User", + "discriminator": "0", + } + return user_dict