From 87dd38a4b1c1fcb9ac34e2624652492ae961f83a Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sun, 9 Jun 2024 12:10:54 +0500 Subject: [PATCH] fix please??? --- commands/Economy/work.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/commands/Economy/work.js b/commands/Economy/work.js index 9b0b7e41..cca86acf 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -28,16 +28,13 @@ class Work extends BaseCommand { */ async execute(client, interaction) { const { member: memberData, user: userData } = interaction.data, - isInCooldown = memberData.cooldowns?.work; + cooldown = memberData.cooldowns?.work, + now = Date.now(); - if (isInCooldown && isInCooldown > Date.now()) - return interaction.error("economy/work:COOLDOWN", { - time: ``, - }); + if (now < cooldown) return interaction.error("economy/work:COOLDOWN", { time: `` }); + if (Math.abs(cooldown - now) > 30 * 60 * 60 * 1000) memberData.workStreak = 0; - if (Date.now() > memberData.cooldowns.work + 30 * 60 * 60 * 1000) memberData.workStreak = 0; - - memberData.cooldowns.work = Date.now() + 24 * 60 * 60 * 1000; + memberData.cooldowns.work = now + 24 * 60 * 60 * 1000; memberData.workStreak = (memberData.workStreak || 0) + 1; const embed = client.embed({