mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat(user)!: enhance user tag getter (#4652)
* feat: enhance user tag getter * feat(user): add `0000` condition and better jsdoc for tag * chore(user): use this keyword instead of destructuring assignment * fix(user): correct isLegacy logic
This commit is contained in:
@@ -1784,7 +1784,7 @@ export interface User {
|
||||
banner?: bigint
|
||||
/** data for the user's avatar decoration */
|
||||
avatarDecorationData?: AvatarDecorationData
|
||||
/** The user tag in the form of username#discriminator */
|
||||
/** The user tag in the form of `username` or `username#discriminator` for legacy username system */
|
||||
tag: string
|
||||
/** Whether the user belongs to an OAuth2 application */
|
||||
bot: boolean
|
||||
|
||||
@@ -11,7 +11,8 @@ export const baseUser: User = {
|
||||
...(undefined as unknown as User),
|
||||
|
||||
get tag() {
|
||||
return `${this.username}#${this.discriminator}`
|
||||
const isLegacy = this.discriminator !== '0' && this.discriminator !== '0000'
|
||||
return isLegacy ? `${this.username}#${this.discriminator}` : this.username
|
||||
},
|
||||
get bot() {
|
||||
return !!this.toggles?.has('bot')
|
||||
|
||||
Reference in New Issue
Block a user