Fallback to real_names if a user has no display_name

This commit is contained in:
Firepup Sixfifty 2024-06-05 12:48:18 -05:00
parent c8cb828b70
commit 889fd9be49
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

View file

@ -50,7 +50,10 @@ except ImportError:
userMappings[f"<@{user['id']}>"] = ( userMappings[f"<@{user['id']}>"] = (
f"<@{user['profile']['display_name']}>" f"<@{user['profile']['display_name']}>"
if user["profile"]["display_name"] if user["profile"]["display_name"]
else f"<@{user['id']}>" else (
f"<@{user['profile']['real_name']}>"
if user["profile"]["real_name"]
else f"<@{user['id']}>")
) )
print("All mappings generated, writing cache file now...") print("All mappings generated, writing cache file now...")
with open("cache.py", "w") as cacheFile: with open("cache.py", "w") as cacheFile: