mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
fix saving data (PLEASEEEEEEEEEEE)
This commit is contained in:
parent
2f3eabb3f3
commit
d92c25228b
4 changed files with 10 additions and 4 deletions
|
@ -146,6 +146,8 @@ class Marry extends BaseCommand {
|
||||||
userData.achievements.married.progress.now = 1;
|
userData.achievements.married.progress.now = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userData.markModified("achievements");
|
||||||
|
otherUserData.markModified("achievements");
|
||||||
await userData.save();
|
await userData.save();
|
||||||
await otherUserData.save();
|
await otherUserData.save();
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Transactions extends BaseCommand {
|
||||||
if (interaction.options.getBoolean("clear")) {
|
if (interaction.options.getBoolean("clear")) {
|
||||||
memberData.transactions = [];
|
memberData.transactions = [];
|
||||||
|
|
||||||
|
memberData.markModified("transactions");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
||||||
|
|
|
@ -30,14 +30,14 @@ class Work extends BaseCommand {
|
||||||
const { member: memberData, user: userData } = interaction.data,
|
const { member: memberData, user: userData } = interaction.data,
|
||||||
isInCooldown = memberData.cooldowns?.work;
|
isInCooldown = memberData.cooldowns?.work;
|
||||||
|
|
||||||
if (isInCooldown && isInCooldown > 0 && isInCooldown > Math.floor(Date.now() / 1000))
|
if (isInCooldown && isInCooldown > Date.now())
|
||||||
return interaction.error("economy/work:COOLDOWN", {
|
return interaction.error("economy/work:COOLDOWN", {
|
||||||
time: `<t:${Math.floor(isInCooldown)}:R>`,
|
time: `<t:${Math.floor(isInCooldown / 1000)}:R>`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Math.floor(Date.now() / 1000) > Math.floor(memberData.cooldowns.work + 30 * 60 * 60)) memberData.workStreak = 0;
|
if (Date.now() > memberData.cooldowns.work + 30 * 60 * 60 * 1000) memberData.workStreak = 0;
|
||||||
|
|
||||||
memberData.cooldowns.work = Math.floor(Date.now() / 1000) + 24 * 60 * 60; // 24 hours
|
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({
|
||||||
|
@ -113,9 +113,11 @@ class Work extends BaseCommand {
|
||||||
userData.achievements.work.achieved = true;
|
userData.achievements.work.achieved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userData.markModified("achievements");
|
||||||
await userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memberData.markModified("cooldowns");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
interaction.reply(messageOptions);
|
interaction.reply(messageOptions);
|
||||||
|
|
|
@ -44,6 +44,7 @@ class Clearwarns extends BaseCommand {
|
||||||
|
|
||||||
memberData.sanctions = [];
|
memberData.sanctions = [];
|
||||||
|
|
||||||
|
memberData.markModified("sanctions");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
interaction.success("moderation/clearwarns:SUCCESS", {
|
interaction.success("moderation/clearwarns:SUCCESS", {
|
||||||
|
|
Loading…
Reference in a new issue