fix(aurora): fixed a NoneType error in utils.fetch_user_dict()
This commit is contained in:
parent
35ad7a77a7
commit
69482c9f45
1 changed files with 5 additions and 12 deletions
|
@ -146,29 +146,22 @@ def generate_dict(result) -> dict:
|
||||||
return case
|
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."""
|
"""This function returns a dictionary containing either user information or a standard deleted user template."""
|
||||||
if user_id == "?":
|
if user_id == "?":
|
||||||
user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"}
|
user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
user = client.get_user(int(user_id))
|
||||||
user = client.get_user(int(user_id))
|
|
||||||
if user is None:
|
|
||||||
user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"}
|
|
||||||
|
|
||||||
|
if user:
|
||||||
user_dict = {
|
user_dict = {
|
||||||
"id": user.id,
|
"id": user.id,
|
||||||
"name": user.name,
|
"name": user.name,
|
||||||
"discriminator": user.discriminator,
|
"discriminator": user.discriminator,
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
except NotFound:
|
user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"}
|
||||||
user_dict = {
|
|
||||||
"id": user_id,
|
|
||||||
"name": "Deleted User",
|
|
||||||
"discriminator": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
return user_dict
|
return user_dict
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue