Fix check for missing discriminator (discord uses 0 not empty discriminator to indicate new username)
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 2376062..3112436 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -165,7 +165,7 @@
const gaveUser = await client.users.fetch(hasPremium[1]);
premiumGuild = `**This server has premium! It was ${
hasPremium[2] === 3 && hasPremium[3]
- ? `automatically applied by ` + (gaveUser.discriminator ? `${gaveUser.username}#${gaveUser.discriminator}` : `@${gaveUser.username}`)
+ ? `automatically applied by ` + (gaveUser.discriminator !== "0" ? `${gaveUser.username}#${gaveUser.discriminator}` : `@${gaveUser.username}`)
: `given by <@${hasPremium[1]}>`
}**\n\n`;
}
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 012f076..f24416a 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -192,7 +192,7 @@
interface TranscriptAuthor {
username: string;
- discriminator?: string;
+ discriminator: string | undefined;
nickname?: string;
id: string;
iconURL?: string;
@@ -390,7 +390,7 @@
type: type,
for: {
username: member!.user.username,
- discriminator: member!.user.discriminator,
+ discriminator: member!.user.discriminator === "0" ? undefined : member!.user.discriminator,
id: member!.user.id,
topRole: {
color: member!.roles.highest.color
@@ -404,7 +404,7 @@
createdTimestamp: Date.now(),
createdBy: {
username: interaction.user.username,
- discriminator: interaction.user.discriminator,
+ discriminator: interaction.user.discriminator === "0" ? undefined : interaction.user.discriminator,
id: interaction.user.id,
topRole: {
color: interactionMember?.roles.highest.color ?? 0x000000
@@ -420,7 +420,7 @@
id: message.id,
author: {
username: message.author.username,
- discriminator: message.author.discriminator,
+ discriminator: message.author.discriminator === "0" ? undefined : message.author.discriminator,
id: message.author.id,
topRole: {
color: message.member ? message.member.roles.highest.color : 0x000000