From eee96ed7bb4bc7823bd382870e6afdbfa5bd5e44 Mon Sep 17 00:00:00 2001 From: V Date: Tue, 27 Jun 2023 18:47:54 +0200 Subject: [PATCH 1/4] Update User.ts --- lib/structures/User.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/structures/User.ts b/lib/structures/User.ts index 4bd63813..bebdc711 100644 --- a/lib/structures/User.ts +++ b/lib/structures/User.ts @@ -68,7 +68,8 @@ export default class User extends Base { } } - private get isMigrated(): boolean { + /** Whether this user has migrated to the new username system */ + get isMigrated(): boolean { return this.globalName !== null && (this.discriminator === undefined || this.discriminator === "0"); } @@ -85,10 +86,10 @@ export default class User extends Base { return `<@${this.id}>`; } - /** This user's display name, if migrated, else a combination of the user's username and discriminator. */ + /** This user's unique username, if migrated, else a combination of the user's username and discriminator. */ get tag(): string { if (this.isMigrated) { - return this.globalName!; + return this.username!; } return `${this.username}#${this.discriminator}`; } From 4ef26eead3534c51e00ec89b96888f1d1a8e9d07 Mon Sep 17 00:00:00 2001 From: V Date: Tue, 27 Jun 2023 18:52:15 +0200 Subject: [PATCH 2/4] remove obsolete non null assertion --- lib/structures/User.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/User.ts b/lib/structures/User.ts index bebdc711..4904c207 100644 --- a/lib/structures/User.ts +++ b/lib/structures/User.ts @@ -89,7 +89,7 @@ export default class User extends Base { /** This user's unique username, if migrated, else a combination of the user's username and discriminator. */ get tag(): string { if (this.isMigrated) { - return this.username!; + return this.username; } return `${this.username}#${this.discriminator}`; } From 3ce97a0765c7bc33b7aff90f389a29b3f273866a Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Tue, 27 Jun 2023 14:13:14 -0500 Subject: [PATCH 3/4] fix docs --- lib/structures/User.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/User.ts b/lib/structures/User.ts index 4904c207..30aab710 100644 --- a/lib/structures/User.ts +++ b/lib/structures/User.ts @@ -68,7 +68,7 @@ export default class User extends Base { } } - /** Whether this user has migrated to the new username system */ + /** If this user has migrated to the new username system. */ get isMigrated(): boolean { return this.globalName !== null && (this.discriminator === undefined || this.discriminator === "0"); } From 44b1aac8351f1cefb3dea6cecb20ad0d4317b01c Mon Sep 17 00:00:00 2001 From: V Date: Tue, 27 Jun 2023 21:17:55 +0200 Subject: [PATCH 4/4] Fix lint --- lib/structures/User.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/structures/User.ts b/lib/structures/User.ts index 30aab710..0d5c9ea5 100644 --- a/lib/structures/User.ts +++ b/lib/structures/User.ts @@ -68,11 +68,6 @@ export default class User extends Base { } } - /** If this user has migrated to the new username system. */ - get isMigrated(): boolean { - return this.globalName !== null && (this.discriminator === undefined || this.discriminator === "0"); - } - /** The default avatar value of this user. */ get defaultAvatar(): number { if (this.isMigrated) { @@ -81,6 +76,11 @@ export default class User extends Base { return Number(this.discriminator) % 5; } + /** If this user has migrated to the new username system. */ + get isMigrated(): boolean { + return this.globalName !== null && (this.discriminator === undefined || this.discriminator === "0"); + } + /** A string that will mention this user. */ get mention(): string { return `<@${this.id}>`;