feat: add support for new username system (#3035)

* feat: add support for new username system

* fix: default avatar calculation in avatarUrl(), also remove support for old system

* fix: use description from docs for user.globalName

* fix: typings

* fix: avatarUrl() to support both old and new username system
This commit is contained in:
Awesome Stickz
2023-06-13 15:39:06 +00:00
committed by GitHub
parent c9c510b0cd
commit f9a5fc1afe
5 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ export function avatarUrl(
options?.size ?? 128,
options?.format,
)
: `https://cdn.discordapp.com/embed/avatars/${Number(discriminator) % 5}.png`
: `https://cdn.discordapp.com/embed/avatars/${discriminator === '0' ? (BigInt(userId) >> BigInt(22)) % BigInt(6) : Number(discriminator) % 5}.png`
}
/**