From 69482c9f451a727d623ce00438fedf0b026a6f70 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 13 Feb 2024 18:25:32 -0500 Subject: [PATCH] fix(aurora): fixed a NoneType error in utils.fetch_user_dict() --- aurora/utilities/utils.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index af5dec1..9c78b9d 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -146,29 +146,22 @@ def generate_dict(result) -> dict: return case -async def fetch_user_dict(client: commands.Bot, user_id: int) -> dict: +async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict: """This function returns a dictionary containing either user information or a standard deleted user template.""" if user_id == "?": user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"} else: - try: - user = client.get_user(int(user_id)) - if user is None: - user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"} + user = client.get_user(int(user_id)) + if user: user_dict = { "id": user.id, "name": user.name, "discriminator": user.discriminator, } - - except NotFound: - user_dict = { - "id": user_id, - "name": "Deleted User", - "discriminator": "0", - } + else: + user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"} return user_dict