Add option to use timestamp on timer command

This commit is contained in:
SileNce5k 2022-09-05 17:00:48 +02:00
parent 6f7ec05dd0
commit 88d5237680
2 changed files with 6 additions and 3 deletions

View file

@ -1,4 +1,4 @@
module.exports = function(time){
module.exports = function(time, currentUnixTime){
let timeInSeconds = parseFloat(time.slice(0, time.length - 1))
let letter = time.slice(time.length - 1)
if(!isNaN(letter)) return parseFloat(time) * 60;
@ -14,6 +14,9 @@ module.exports = function(time){
case "D":
timeInSeconds = timeInSeconds * 86400;
break;
case "T": // TODO: Make it so that I can have multiple letters per case, so that "TS" would work here.
timeInSeconds = timeInSeconds - currentUnixTime;
break;
default:
timeInSeconds = NaN;
}