Skip to content

Commit b1449c3

Browse files
authored
fix defaultAvatarIndex calculation in activity code examples (#6809)
1 parent 8d9b4d5 commit b1449c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/activities/Development_Guides.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ let avatarSrc = '';
769769
if (user.avatar) {
770770
avatarSrc = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=256`;
771771
} else {
772-
const defaultAvatarIndex = Math.abs(Number(user.id) >> 22) % 6;
772+
const defaultAvatarIndex = (BigInt(user.id) >> 22n) % 6n;
773773
avatarSrc = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarIndex}.png`
774774
}
775775

@@ -811,7 +811,7 @@ fetch(`https://discord.com/api/users/@me/guilds/${DiscordRPC.guildId}/member`, {
811811
} else if (user.avatar) {
812812
guildAvatarSrc = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=256`;
813813
} else {
814-
const defaultAvatarIndex = Math.abs(Number(user.id) >> 22) % 6;
814+
const defaultAvatarIndex = (BigInt(user.id) >> 22n) % 6n;
815815
avatarSrc = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarIndex}.png`;
816816
}
817817

0 commit comments

Comments
 (0)