Use new default avatar calculation
This commit is contained in:
parent
df4792080e
commit
658e2f3e84
@ -27,10 +27,10 @@ async function destroySession() {
|
|||||||
function getAvatarUrl(userData: { [k: string]: any }): string {
|
function getAvatarUrl(userData: { [k: string]: any }): string {
|
||||||
const BASE = "https://cdn.discordapp.com/";
|
const BASE = "https://cdn.discordapp.com/";
|
||||||
|
|
||||||
if (!userData.id) return "";
|
if (!userData.id || typeof window["BigInt"] === "undefined") return "";
|
||||||
|
|
||||||
if (!userData.avatar)
|
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}`;
|
return BASE + `avatars/${userData.id}/${userData.avatar}`;
|
||||||
}
|
}
|
||||||
@ -151,9 +151,7 @@ export default function (props: {
|
|||||||
display={data.id ? "flex" : "none"}
|
display={data.id ? "flex" : "none"}
|
||||||
src={getAvatarUrl(data)}
|
src={getAvatarUrl(data)}
|
||||||
/>
|
/>
|
||||||
<Text>
|
<Text>{data.id ? data.username : ""}</Text>
|
||||||
{data.id ? `${data.username}#${data.discriminator}` : ""}
|
|
||||||
</Text>
|
|
||||||
<Button
|
<Button
|
||||||
onClick={async () => await destroySession()}
|
onClick={async () => await destroySession()}
|
||||||
size="md"
|
size="md"
|
||||||
@ -203,7 +201,7 @@ export default function (props: {
|
|||||||
</Link>
|
</Link>
|
||||||
<Avatar display={data.id ? "" : "none"} src={getAvatarUrl(data)} />
|
<Avatar display={data.id ? "" : "none"} src={getAvatarUrl(data)} />
|
||||||
<Text align="center" style={{ overflowWrap: "anywhere" }}>
|
<Text align="center" style={{ overflowWrap: "anywhere" }}>
|
||||||
{data.id ? `${data.username}#${data.discriminator}` : ""}
|
{data.id ? data.username : ""}
|
||||||
</Text>
|
</Text>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user