mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
fix please???
This commit is contained in:
parent
d348260504
commit
87dd38a4b1
1 changed files with 5 additions and 8 deletions
|
@ -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: `<t:${Math.floor(isInCooldown / 1000)}:R>`,
|
||||
});
|
||||
if (now < cooldown) return interaction.error("economy/work:COOLDOWN", { time: `<t:${Math.floor(cooldown / 1000)}:R>` });
|
||||
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({
|
||||
|
|
Loading…
Reference in a new issue