> Add Daily and weekly coins

This commit is contained in:
Christopher Cookman 2023-08-18 15:34:38 -06:00
parent 384ea5d1d3
commit 3636d6a832
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 50 additions and 0 deletions

View file

@ -204,5 +204,15 @@
"required": true
}
]
},
{
"name": "daily",
"description": "Claim your daily coins",
"type": 1
},
{
"name": "weekly",
"description": "Claim your weekly coins",
"type": 1
}
]

View file

@ -727,6 +727,46 @@ client.on("interactionCreate", async interaction => {
}]
});
}
break;
case "daily": // Daily 2 coins
curCooldown = await checkCooldown(interaction.user, "daily")
if (curCooldown) {
return interaction.reply({
content: `Check back <t:${Math.floor(await checkCooldown(interaction.user, "daily") / 1000)}:R>.`,
ephemeral: true
});
}
// 24 hours
setCooldown(interaction.user, "daily", 24 * 60 * 60 * 1000)
await checkAndModifyPoints(interaction.user, 2);
interaction.reply({
embeds: [{
title: "Daily",
description: `You got 2 coins!`,
color: 0x00ff00
}]
});
break;
case "weekly": // Weekly 14 coins
curCooldown = await checkCooldown(interaction.user, "weekly")
if (curCooldown) {
return interaction.reply({
content: `Check back <t:${Math.floor(await checkCooldown(interaction.user, "weekly") / 1000)}:R>.`,
ephemeral: true
});
}
// 7 days
setCooldown(interaction.user, "weekly", 7 * 24 * 60 * 60 * 1000)
await checkAndModifyPoints(interaction.user, 14);
interaction.reply({
embeds: [{
title: "Weekly",
description: `You got 14 coins!`,
color: 0x00ff00
}]
});
break;
};
});