Moved to using date locale method

This commit is contained in:
2024-09-26 15:25:52 +02:00
parent 7ff5ad5d9c
commit f0be3655a7
3 changed files with 3 additions and 38 deletions

View File

@@ -110,20 +110,7 @@ export default async function guildInfo(interaction: ChatInputCommandInteraction
const guildExp = new Intl.NumberFormat("en-US").format(guildExpUnformatted) const guildExp = new Intl.NumberFormat("en-US").format(guildExpUnformatted)
const guildLvl = guildLevel(guildExpUnformatted) const guildLvl = guildLevel(guildExpUnformatted)
const guildMembers = guild!.members const guildMembers = guild!.members
const guildCreatedTime = guildCreated.toLocaleString("hr-HR", {})
const guildCreatedDate = guildCreated.getDate()
const guildCreatedMonth = guildCreated.getMonth() + 1
const guildCreatedYear = guildCreated.getFullYear()
const guildCreatedHour = guildCreated.getHours()
const guildCreatedMinute = guildCreated.getMinutes()
const guildCreatedSecond = guildCreated.getSeconds()
const guildCreatedTime = guildCreatedDate + "." +
guildCreatedMonth + "." +
guildCreatedYear + " " +
guildCreatedHour + ":" +
guildCreatedMinute + ":" +
guildCreatedSecond
const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid
const guildOwnerName = await getIGN(guildOwner) const guildOwnerName = await getIGN(guildOwner)

View File

@@ -111,19 +111,7 @@ export default async function guildMember(interaction: ChatInputCommandInteracti
const guildMemberJoinMS = guildMember!.joined const guildMemberJoinMS = guildMember!.joined
const guildMemberJoinTime = new Date(guildMemberJoinMS) const guildMemberJoinTime = new Date(guildMemberJoinMS)
const guildMemberJoinDate = guildMemberJoinTime.getDate() const guildMemberJoin = guildMemberJoinTime.toLocaleString("hr-HR", {})
const guildMemberJoinMonth = guildMemberJoinTime.getMonth() + 1
const guildMemberJoinYear = guildMemberJoinTime.getFullYear()
const guildMemberJoinHours = guildMemberJoinTime.getHours()
const guildMemberJoinMinutes = guildMemberJoinTime.getMinutes()
const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds()
const guildMemberJoin = guildMemberJoinDate + "." +
guildMemberJoinMonth + "." +
guildMemberJoinYear + " " +
guildMemberJoinHours + ":" +
guildMemberJoinMinutes + ":" +
guildMemberJoinSeconds
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{

View File

@@ -1,5 +1,5 @@
import { devMessage, embedColor } from "config/options.js" import { devMessage, embedColor } from "config/options.js"
import { ChannelType, ChatInputCommandInteraction } from "discord.js" import { ChatInputCommandInteraction } from "discord.js"
import { IGuildData } from "interfaces" import { IGuildData } from "interfaces"
import { getGuild, getIGN, getPlayer, getUUID } from "utils/Hypixel.js" import { getGuild, getIGN, getPlayer, getUUID } from "utils/Hypixel.js"
import { redis } from "utils/Illegitimate.js" import { redis } from "utils/Illegitimate.js"
@@ -12,16 +12,6 @@ export default async function guildTop(interaction: ChatInputCommandInteraction)
let amount = interaction.options.getNumber("amount") || 10 let amount = interaction.options.getNumber("amount") || 10
let guild: IGuildData | null let guild: IGuildData | null
if (interaction.channel!.type === ChannelType.DM) {
interaction.editReply({
embeds: [{
description: "You can't use this command in DMs!",
color: embedColor
}]
})
return
}
if (type === "ign") { if (type === "ign") {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{