diff --git a/src/commands/economy/exam.ts b/src/commands/economy/exam.ts index fdc52df..5ec6f3e 100644 --- a/src/commands/economy/exam.ts +++ b/src/commands/economy/exam.ts @@ -47,6 +47,7 @@ export const exam = createCommand({ // Set exam day to today const nextExamDate = new Date(now); nextExamDate.setDate(now.getDate() + 7); + nextExamDate.setHours(0, 0, 0, 0); const nextExamTimestamp = Math.floor(nextExamDate.getTime() / 1000); const metadata: ExamMetadata = { @@ -65,7 +66,7 @@ export const exam = createCommand({ await interaction.editReply({ embeds: [createSuccessEmbed( `You have registered for the exam! Your exam day is **${DAYS[currentDay]}** (Server Time).\n` + - `Come back on () to take your first exam!`, + `Come back on () to take your first exam!`, "Exam Registration Successful" )] }); @@ -76,15 +77,17 @@ export const exam = createCommand({ const examDay = metadata.examDay; // 3. Cooldown Check - if (now < new Date(timer.expiresAt)) { + const expiresAt = new Date(timer.expiresAt); + expiresAt.setHours(0, 0, 0, 0); + + if (now < expiresAt) { // Calculate time remaining - const expiresAt = new Date(timer.expiresAt); const timestamp = Math.floor(expiresAt.getTime() / 1000); await interaction.editReply({ embeds: [createErrorEmbed( `You have already taken your exam for this week (or are waiting for your first week to pass).\n` + - `Next exam available: ()` + `Next exam available: ()` )] }); return; @@ -98,6 +101,7 @@ export const exam = createCommand({ const nextExamDate = new Date(now); nextExamDate.setDate(now.getDate() + daysUntil); + nextExamDate.setHours(0, 0, 0, 0); const nextExamTimestamp = Math.floor(nextExamDate.getTime() / 1000); const newMetadata: ExamMetadata = { @@ -120,7 +124,7 @@ export const exam = createCommand({ embeds: [createErrorEmbed( `You missed your exam day! Your exam day is **${DAYS[examDay]}** (Server Time).\n` + `You verify your attendance but score a **0**.\n` + - `Your next exam opportunity is: ()`, + `Your next exam opportunity is: ()`, "Exam Failed" )] }); @@ -147,6 +151,7 @@ export const exam = createCommand({ // 6. Update State const nextExamDate = new Date(now); nextExamDate.setDate(now.getDate() + 7); + nextExamDate.setHours(0, 0, 0, 0); const nextExamTimestamp = Math.floor(nextExamDate.getTime() / 1000); const newMetadata: ExamMetadata = { @@ -182,7 +187,7 @@ export const exam = createCommand({ `**XP Gained:** ${diff.toString()}\n` + `**Multiplier:** x${multiplier.toFixed(2)}\n` + `**Reward:** ${reward.toString()} Currency\n\n` + - `See you next week: `, + `See you next week: `, "Exam Passed!" )] });