fix stats not working in DMs

This commit is contained in:
Jonny_Bro (Nikita) 2023-08-05 18:51:39 +05:00
parent e89e53ef58
commit 7d0680d5aa
No known key found for this signature in database
GPG key ID: 28B0D27F8DD5A4C9
2 changed files with 2 additions and 2 deletions

View file

@ -72,7 +72,7 @@ class Stats extends BaseCommand {
{ {
name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"),
value: interaction.translate("general/stats:ONLINE_CONTENT", { value: interaction.translate("general/stats:ONLINE_CONTENT", {
time: client.functions.convertTime(client, Date.now() + client.uptime, true, true, data.guildData.language), time: client.functions.convertTime(client, Date.now() + client.uptime, true, true, data?.guildData?.language),
}), }),
}, },
{ {

View file

@ -109,7 +109,7 @@ module.exports = {
* @param {String} locale Language * @param {String} locale Language
* @returns {String} Time * @returns {String} Time
*/ */
convertTime(client, time, type = false, noPrefix = false, locale = this.defaultLanguage) { convertTime(client, time, type = false, noPrefix = false, locale = client.defaultLanguage) {
const languageData = client.languages.find(language => language.name === locale); const languageData = client.languages.find(language => language.name === locale);
const m = moment(time).locale(languageData.moment); const m = moment(time).locale(languageData.moment);
return type ? m.toNow(noPrefix) : m.fromNow(noPrefix); return type ? m.toNow(noPrefix) : m.fromNow(noPrefix);