diff --git a/components/Navigation.tsx b/components/Navigation.tsx index a22762a..5669fb3 100644 --- a/components/Navigation.tsx +++ b/components/Navigation.tsx @@ -27,10 +27,10 @@ async function destroySession() { function getAvatarUrl(userData: { [k: string]: any }): string { const BASE = "https://cdn.discordapp.com/"; - if (!userData.id) return ""; + if (!userData.id || typeof window["BigInt"] === "undefined") return ""; if (!userData.avatar) - return BASE + `embed/avatars/${parseInt(userData.discriminator) % 5}.png`; + return BASE + `embed/avatars/${(BigInt(userData.id) >> 22n) % 6n}.png`; return BASE + `avatars/${userData.id}/${userData.avatar}`; } @@ -151,9 +151,7 @@ export default function (props: { display={data.id ? "flex" : "none"} src={getAvatarUrl(data)} /> - <Text> - {data.id ? `${data.username}#${data.discriminator}` : ""} - </Text> + <Text>{data.id ? data.username : ""}</Text> <Button onClick={async () => await destroySession()} size="md" @@ -203,7 +201,7 @@ export default function (props: { </Link> <Avatar display={data.id ? "" : "none"} src={getAvatarUrl(data)} /> <Text align="center" style={{ overflowWrap: "anywhere" }}> - {data.id ? `${data.username}#${data.discriminator}` : ""} + {data.id ? data.username : ""} </Text> <svg xmlns="http://www.w3.org/2000/svg"