Moved formatters to seperate file

This commit is contained in:
2024-10-16 19:51:05 +02:00
parent e0f4f2c0c8
commit 9f223f4b91
5 changed files with 19 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import { ChatInputCommandInteraction } from "discord.js"
import { devMessage, embedColor } from "~/config/options.js"
import { numberFormatter } from "~/utils/Functions/intlFormaters.js"
import { getGuild, getHeadURL, getPlayer, getUUID } from "~/utils/Hypixel.js"
export default async function guildMember(interaction: ChatInputCommandInteraction): Promise<void> {
@@ -101,13 +102,13 @@ export default async function guildMember(interaction: ChatInputCommandInteracti
const guildRank = guildMember!.rank
const memberGexp = guildMember!.expHistory
const allDaysGexp = Object.keys(memberGexp).map(key => {
return ("**➺ " + key + ":** " + "`" + new Intl.NumberFormat("en-US").format(memberGexp[key]) + "`" + "\n")
return ("**➺ " + key + ":** " + "`" + numberFormatter.format(memberGexp[key]) + "`" + "\n")
})
const expValue = allDaysGexp.join("")
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce((a, b) => a + b, 0)
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(totalWeeklyGexpUnformatted)
const totalWeeklyGexp = numberFormatter.format(totalWeeklyGexpUnformatted)
const averageWeeklyGexpUnformatted = Math.round(totalWeeklyGexpUnformatted / 7)
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(averageWeeklyGexpUnformatted)
const averageWeeklyGexp = numberFormatter.format(averageWeeklyGexpUnformatted)
const guildMemberJoinMS = guildMember!.joined
const guildMemberJoinTime = new Date(guildMemberJoinMS)