diff --git a/commands.json b/commands.json index 8f17bae..29fc52a 100644 --- a/commands.json +++ b/commands.json @@ -204,5 +204,15 @@ "required": true } ] + }, + { + "name": "daily", + "description": "Claim your daily coins", + "type": 1 + }, + { + "name": "weekly", + "description": "Claim your weekly coins", + "type": 1 } ] diff --git a/index.js b/index.js index 4cba945..36c011c 100644 --- a/index.js +++ b/index.js @@ -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 .`, + 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 .`, + 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; + }; });