Added new formatter
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
import { devMessage, embedColor } from "~/config/options.js"
|
||||
import { IGuildData } from "~/interfaces"
|
||||
import { numberFormatter } from "~/utils/Functions/intlFormaters.js"
|
||||
import { dateTimeFormatter, numberFormatter } from "~/utils/Functions/intlFormaters.js"
|
||||
import { getGuild, getIGN, getPlayer, getUUID, guildLevel } from "~/utils/Hypixel.js"
|
||||
|
||||
export default async function guildInfo(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
@@ -111,7 +111,7 @@ export default async function guildInfo(interaction: ChatInputCommandInteraction
|
||||
const guildExp = numberFormatter.format(guildExpUnformatted)
|
||||
const guildLvl = guildLevel(guildExpUnformatted)
|
||||
const guildMembers = guild!.members
|
||||
const guildCreatedTime = guildCreated.toLocaleString("hr-HR", {})
|
||||
const guildCreatedTime = dateTimeFormatter.format(guildCreated)
|
||||
|
||||
const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid
|
||||
const guildOwnerName = await getIGN(guildOwner)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
import { devMessage, embedColor } from "~/config/options.js"
|
||||
import { numberFormatter } from "~/utils/Functions/intlFormaters.js"
|
||||
import { dateTimeFormatter, numberFormatter } from "~/utils/Functions/intlFormaters.js"
|
||||
import { getGuild, getHeadURL, getPlayer, getUUID } from "~/utils/Hypixel.js"
|
||||
|
||||
export default async function guildMember(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
@@ -112,7 +112,7 @@ export default async function guildMember(interaction: ChatInputCommandInteracti
|
||||
|
||||
const guildMemberJoinMS = guildMember!.joined
|
||||
const guildMemberJoinTime = new Date(guildMemberJoinMS)
|
||||
const guildMemberJoin = guildMemberJoinTime.toLocaleString("hr-HR", {})
|
||||
const guildMemberJoin = dateTimeFormatter.format(guildMemberJoinTime)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { GuildMember, userMention } from "discord.js"
|
||||
import { userMention } from "discord.js"
|
||||
import { embedColor } from "~/config/options.js"
|
||||
import { IEvent } from "~/interfaces"
|
||||
import { dateTimeFormatter } from "~/utils/Functions/intlFormaters"
|
||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||
|
||||
export default {
|
||||
event: "guildMemberAdd",
|
||||
execute(member: GuildMember) {
|
||||
execute(member) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
logToChannel("bot", {
|
||||
embeds: [{
|
||||
title: "New Member",
|
||||
description: userMention(member.id) + " has joined the server.\n" +
|
||||
"Account created: " + member.user.createdAt.toLocaleString(),
|
||||
"Account created: " + dateTimeFormatter.format(member.user.createdAt),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || ""
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
const numberFormatter = new Intl.NumberFormat("en-US")
|
||||
|
||||
export { numberFormatter }
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat("hr-HR", {
|
||||
year: "numeric",
|
||||
month: "numeric",
|
||||
day: "numeric",
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
second: "numeric"
|
||||
})
|
||||
|
||||
export { dateTimeFormatter, numberFormatter }
|
||||
|
||||
Reference in New Issue
Block a user