Skip to content

Commit

Permalink
fix defaultAvatarIndex calculation in activity code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
advaith1 committed Apr 18, 2024
1 parent df7d365 commit 35992b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/activities/Development_Guides.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ let avatarSrc = '';
if (user.avatar) {
avatarSrc = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=256`;
} else {
const defaultAvatarIndex = Math.abs(Number(user.id) >> 22) % 6;
const defaultAvatarIndex = (BigInt(user.id) >> 22n) % 6n;
avatarSrc = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarIndex}.png`
}

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

Expand Down

0 comments on commit 35992b2

Please sign in to comment.