Compare commits

...

2 commits

Author SHA1 Message Date
24cc4eb26d
Check if the date is in the past
All checks were successful
CI / CI (push) Successful in 1m22s
2025-05-14 18:21:13 +02:00
a16263c04e
Remove unneeded fs require 2025-05-14 07:57:08 +02:00

View file

@ -1,4 +1,3 @@
const fs = require('fs');
const parseTime = require('./parseTime'); const parseTime = require('./parseTime');
const timeUntil = require('./timeUntil'); const timeUntil = require('./timeUntil');
const sqlite3 = require('sqlite3').verbose(); const sqlite3 = require('sqlite3').verbose();
@ -11,6 +10,9 @@ module.exports = async function (message, args) {
let timeInSeconds; let timeInSeconds;
if(Date.parse(args[0]) && parseFloat(args[0]).toString() === args[0]){ if(Date.parse(args[0]) && parseFloat(args[0]).toString() === args[0]){
timeInSeconds = timeUntil(args[0]); timeInSeconds = timeUntil(args[0]);
if(timeUntil.totalInSeconds < 0){
return message.channel.send("The date must not be in the past.");
}
}else { }else {
timeInSeconds = parseTime(args[0], currentUnixTime); timeInSeconds = parseTime(args[0], currentUnixTime);
} }