fix please???

This commit is contained in:
Jonny_Bro (Nikita) 2024-06-09 12:10:54 +05:00
parent d348260504
commit 87dd38a4b1
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8

View file

@ -28,16 +28,13 @@ class Work extends BaseCommand {
*/ */
async execute(client, interaction) { async execute(client, interaction) {
const { member: memberData, user: userData } = interaction.data, const { member: memberData, user: userData } = interaction.data,
isInCooldown = memberData.cooldowns?.work; cooldown = memberData.cooldowns?.work,
now = Date.now();
if (isInCooldown && isInCooldown > Date.now()) if (now < cooldown) return interaction.error("economy/work:COOLDOWN", { time: `<t:${Math.floor(cooldown / 1000)}:R>` });
return interaction.error("economy/work:COOLDOWN", { if (Math.abs(cooldown - now) > 30 * 60 * 60 * 1000) memberData.workStreak = 0;
time: `<t:${Math.floor(isInCooldown / 1000)}:R>`,
});
if (Date.now() > memberData.cooldowns.work + 30 * 60 * 60 * 1000) memberData.workStreak = 0; memberData.cooldowns.work = now + 24 * 60 * 60 * 1000;
memberData.cooldowns.work = Date.now() + 24 * 60 * 60 * 1000;
memberData.workStreak = (memberData.workStreak || 0) + 1; memberData.workStreak = (memberData.workStreak || 0) + 1;
const embed = client.embed({ const embed = client.embed({