Port User.tag getter from pomelo as utility

This commit is contained in:
Rory&
2026-01-23 09:18:54 +01:00
parent 31345651db
commit 9368066ec5
5 changed files with 10 additions and 3 deletions
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -68,7 +68,7 @@ router.post(
if (user && user.email) {
Email.sendResetPassword(user, user.email).catch((e) => {
console.error(`Failed to send password reset email to ${user.username}#${user.discriminator} (${user.id}): ${e}`);
console.error(`Failed to send password reset email to ${user.tag} (${user.id}): ${e}`);
});
}
},
+1 -1
View File
@@ -56,7 +56,7 @@ router.post(
return res.sendStatus(204);
})
.catch((e) => {
console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`);
console.error(`Failed to send verification email to ${user.tag}: ${e}`);
throw new HTTPError("Failed to send verification email", 500);
});
},
+8 -1
View File
@@ -245,6 +245,13 @@ export class User extends BaseClass {
}
}
public get tag(): string {
//const { uniqueUsernames } = Config.get().general;
const uniqueUsernames = false;
return uniqueUsernames ? this.username : `${this.username}#${this.discriminator}`;
}
static async register({
email,
username,
@@ -310,7 +317,7 @@ export class User extends BaseClass {
// send verification email if users aren't verified by default and we have an email
if (!Config.get().defaults.user.verified && email) {
await Email.sendVerifyEmail(user, email).catch((e) => {
console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`);
console.error(`Failed to send verification email to ${user.tag}: ${e}`);
});
}