From 7d0680d5aacebaa28e57d4682e8bf906dd2fcaad Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sat, 5 Aug 2023 18:51:39 +0500 Subject: [PATCH] fix stats not working in DMs --- commands/General/stats.js | 2 +- helpers/functions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/General/stats.js b/commands/General/stats.js index 1d1ef79c..26dc3f38 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -72,7 +72,7 @@ class Stats extends BaseCommand { { name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), 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), }), }, { diff --git a/helpers/functions.js b/helpers/functions.js index 2596af9a..43d9ce92 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -109,7 +109,7 @@ module.exports = { * @param {String} locale Language * @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 m = moment(time).locale(languageData.moment); return type ? m.toNow(noPrefix) : m.fromNow(noPrefix);