mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-30 15:30:09 +00:00
feat: support new username system (#765)
This commit is contained in:
@@ -18,9 +18,13 @@ export interface APIUser {
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The user's 4-digit discord-tag
|
||||
* The user's Discord-tag
|
||||
*/
|
||||
discriminator: string;
|
||||
/**
|
||||
* The user's display name, if it is set. For bots, this is the application name
|
||||
*/
|
||||
global_name: string | null;
|
||||
/**
|
||||
* The user's avatar hash
|
||||
*
|
||||
|
||||
@@ -18,9 +18,13 @@ export interface APIUser {
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The user's 4-digit discord-tag
|
||||
* The user's Discord-tag
|
||||
*/
|
||||
discriminator: string;
|
||||
/**
|
||||
* The user's display name, if it is set. For bots, this is the application name
|
||||
*/
|
||||
global_name: string | null;
|
||||
/**
|
||||
* The user's avatar hash
|
||||
*
|
||||
|
||||
@@ -962,14 +962,16 @@ export const CDNRoutes = {
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/embed/avatars/{user.discriminator % 5}.png`
|
||||
* - GET `/embed/avatars/{index}.png`
|
||||
*
|
||||
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
|
||||
* The value for `index` parameter depends on whether the user is [migrated to the new username system](https://discord.com/developers/docs/change-log#unique-usernames-on-discord).
|
||||
* For users on the new username system, `index` will be `(user.id >> 22) % 6`.
|
||||
* For users on the legacy username system, `index` will be `user.discriminator % 5`.
|
||||
*
|
||||
* This route supports the extension: PNG
|
||||
*/
|
||||
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${userDiscriminator}.png` as const;
|
||||
defaultUserAvatar(index: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${index}.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -971,14 +971,16 @@ export const CDNRoutes = {
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/embed/avatars/{user.discriminator % 5}.png`
|
||||
* - GET `/embed/avatars/{index}.png`
|
||||
*
|
||||
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
|
||||
* The value for `index` parameter depends on whether the user is [migrated to the new username system](https://discord.com/developers/docs/change-log#unique-usernames-on-discord).
|
||||
* For users on the new username system, `index` will be `(user.id >> 22) % 6`.
|
||||
* For users on the legacy username system, `index` will be `user.discriminator % 5`.
|
||||
*
|
||||
* This route supports the extension: PNG
|
||||
*/
|
||||
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${userDiscriminator}.png` as const;
|
||||
defaultUserAvatar(index: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${index}.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,13 @@ export interface APIUser {
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The user's 4-digit discord-tag
|
||||
* The user's Discord-tag
|
||||
*/
|
||||
discriminator: string;
|
||||
/**
|
||||
* The user's display name, if it is set. For bots, this is the application name
|
||||
*/
|
||||
global_name: string | null;
|
||||
/**
|
||||
* The user's avatar hash
|
||||
*
|
||||
|
||||
@@ -18,9 +18,13 @@ export interface APIUser {
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The user's 4-digit discord-tag
|
||||
* The user's Discord-tag
|
||||
*/
|
||||
discriminator: string;
|
||||
/**
|
||||
* The user's display name, if it is set. For bots, this is the application name
|
||||
*/
|
||||
global_name: string | null;
|
||||
/**
|
||||
* The user's avatar hash
|
||||
*
|
||||
|
||||
@@ -962,14 +962,16 @@ export const CDNRoutes = {
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/embed/avatars/{user.discriminator % 5}.png`
|
||||
* - GET `/embed/avatars/{index}.png`
|
||||
*
|
||||
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
|
||||
* The value for `index` parameter depends on whether the user is [migrated to the new username system](https://discord.com/developers/docs/change-log#unique-usernames-on-discord).
|
||||
* For users on the new username system, `index` will be `(user.id >> 22) % 6`.
|
||||
* For users on the legacy username system, `index` will be `user.discriminator % 5`.
|
||||
*
|
||||
* This route supports the extension: PNG
|
||||
*/
|
||||
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${userDiscriminator}.png` as const;
|
||||
defaultUserAvatar(index: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${index}.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -971,14 +971,16 @@ export const CDNRoutes = {
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/embed/avatars/{user.discriminator % 5}.png`
|
||||
* - GET `/embed/avatars/{index}.png`
|
||||
*
|
||||
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
|
||||
* The value for `index` parameter depends on whether the user is [migrated to the new username system](https://discord.com/developers/docs/change-log#unique-usernames-on-discord).
|
||||
* For users on the new username system, `index` will be `(user.id >> 22) % 6`.
|
||||
* For users on the legacy username system, `index` will be `user.discriminator % 5`.
|
||||
*
|
||||
* This route supports the extension: PNG
|
||||
*/
|
||||
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${userDiscriminator}.png` as const;
|
||||
defaultUserAvatar(index: DefaultUserAvatarAssets) {
|
||||
return `/embed/avatars/${index}.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user