diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js index a548c3ef..fd04de72 100644 --- a/commands/Economy/birthdate.js +++ b/commands/Economy/birthdate.js @@ -93,7 +93,7 @@ class Birthdate extends BaseCommand { await data.userData.save(); interaction.success("economy/birthdate:SUCCESS", { - date: client.functions.printDate(client, d), + date: client.functions.printDate(client, d, null, data.guildData.language), }); } } diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index a80be786..57a38a8f 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -114,12 +114,12 @@ class Profile extends BaseCommand { }, { name: interaction.translate("economy/profile:REGISTERED"), - value: client.functions.printDate(client, new Date(memberData.registeredAt)), + value: client.functions.printDate(client, new Date(memberData.registeredAt), null, data.guildData.language), inline: true, }, { name: interaction.translate("economy/profile:BIRTHDATE"), - value: !userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.functions.printDate(client, new Date(userData.birthdate)), + value: !userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.functions.printDate(client, new Date(userData.birthdate), null, data.guildData.language), inline: true, }, { diff --git a/commands/General/report.js b/commands/General/report.js index d15176e3..35a74dca 100644 --- a/commands/General/report.js +++ b/commands/General/report.js @@ -76,7 +76,7 @@ class Report extends BaseCommand { .addFields([ { name: interaction.translate("common:DATE"), - value: client.functions.printDate(client, new Date(Date.now())), + value: client.functions.printDate(client, new Date(Date.now()), null, data.guildData.language), }, { name: interaction.translate("common:AUTHOR"), diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index ba9b1695..09610c37 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -34,7 +34,7 @@ class Serverinfo extends BaseCommand { * @param {import("discord.js").ChatInputCommandInteraction} interaction * @param {Object} data */ - async execute(client, interaction) { + async execute(client, interaction, data) { const guild = interaction.guild; await guild.members.fetch(); @@ -58,7 +58,7 @@ class Serverinfo extends BaseCommand { }, { name: client.customEmojis.calendar + interaction.translate("common:CREATION"), - value: client.functions.printDate(client, guild.createdAt), + value: client.functions.printDate(client, guild.createdAt, null, data.guildData.language), inline: true, }, { diff --git a/commands/General/suggest.js b/commands/General/suggest.js index 92daf0c6..b3a22a05 100644 --- a/commands/General/suggest.js +++ b/commands/General/suggest.js @@ -60,7 +60,7 @@ class Suggest extends BaseCommand { .addFields([ { name: interaction.translate("common:DATE"), - value: client.functions.printDate(client, new Date(Date.now())), + value: client.functions.printDate(client, new Date(Date.now()), null, data.guildData.language), }, { name: interaction.translate("common:AUTHOR"), diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js index 42609d5a..6249cce3 100644 --- a/commands/General/userinfo.js +++ b/commands/General/userinfo.js @@ -43,7 +43,7 @@ class Userinfo extends BaseCommand { * @param {import("discord.js").ChatInputCommandInteraction} interaction * @param {Object} data */ - async execute(client, interaction) { + async execute(client, interaction, data) { const member = interaction.options.getMember("user") || interaction.member; const embed = new EmbedBuilder() .setAuthor({ @@ -78,12 +78,12 @@ class Userinfo extends BaseCommand { }, { name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"), - value: client.functions.printDate(client, member.user.createdAt), + value: client.functions.printDate(client, member.user.createdAt, null, data.guildData.language), inline: true, }, { name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"), - value: client.functions.printDate(client, member.joinedAt), + value: client.functions.printDate(client, member.joinedAt, null, data.guildData.language), inline: true, }, { diff --git a/commands/Tickets/closeticket.js b/commands/Tickets/closeticket.js index 367e8e65..a6fad1db 100644 --- a/commands/Tickets/closeticket.js +++ b/commands/Tickets/closeticket.js @@ -83,7 +83,7 @@ class CloseTicket extends BaseCommand { let transcript = "---- TICKET CREATED ----\n"; messages.forEach(message => { - transcript += `[${client.functions.printDate(client, message.createdTimestamp)}] ${message.author.getUsername()}: ${message.content}\n`; + transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, data.guildData.language)}] ${message.author.getUsername()}: ${message.content}\n`; }); transcript += "---- TICKET CLOSED ----"; diff --git a/commands/Tickets/createticketembed.js b/commands/Tickets/createticketembed.js index bffe47f4..a3ed92b9 100644 --- a/commands/Tickets/createticketembed.js +++ b/commands/Tickets/createticketembed.js @@ -140,7 +140,7 @@ class CreateTicketEmbed extends BaseCommand { let transcript = "---- TICKET CREATED ----\n"; messages.forEach(message => { - transcript += `[${client.functions.printDate(client, message.createdTimestamp)}] ${message.author.getUsername()}: ${message.content}\n`; + transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.guild.data.language)}] ${message.author.getUsername()}: ${message.content}\n`; }); transcript += "---- TICKET CLOSED ----"; @@ -180,7 +180,7 @@ class CreateTicketEmbed extends BaseCommand { let transcript = "---- TICKET CREATED ----\n"; messages.forEach(message => { - transcript += `[${client.functions.printDate(client, message.createdTimestamp)}] ${message.author.getUsername()}: ${message.content}\n`; + transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.guild.data.language)}] ${message.author.getUsername()}: ${message.content}\n`; }); transcript += "---- TICKET CLOSED ----"; diff --git a/helpers/functions.js b/helpers/functions.js index 59c144d4..2596af9a 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -94,7 +94,7 @@ module.exports = { * @param {String} locale Language * @returns {String} Beautified date */ - printDate(client, date, format = "", locale = client.defaultLanguage) { + printDate(client, date, format = null, locale = client.defaultLanguage) { const languageData = client.languages.find(language => language.name === locale); if (format === "" || format === null) format = languageData.defaultMomentFormat; return moment(new Date(date)).locale(languageData.moment).format(format);