From 0dc6af59844a8bc5968378d8be6c89499f35159d Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Thu, 15 May 2025 04:38:50 +0200 Subject: [PATCH 1/4] Return text to send instead of sending in util function --- util/timer/createTimer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/timer/createTimer.js b/util/timer/createTimer.js index 28e1c6e..77e3ebe 100644 --- a/util/timer/createTimer.js +++ b/util/timer/createTimer.js @@ -4,20 +4,20 @@ const sqlite3 = require('sqlite3').verbose(); module.exports = async function (message, args) { const databasePath = 'data/database.db' if (args.length < 2) - return message.channel.send("Please specify a time, and a message to send after the timer has finished"); + return "Please specify a time, and a message to send after the timer has finished"; let currentUnixTime = Math.floor(new Date() / 1000); let timeInSeconds; if(!isNaN(Date.parse(args[0])) && isNaN(parseTime(args[0]))){ timeInSeconds = timeUntil(args[0]).totalInSeconds; if(timeInSeconds < 0){ - return message.channel.send("The date must not be in the past."); + return "The date must not be in the past." } }else { timeInSeconds = parseTime(args[0], currentUnixTime); } if (isNaN(timeInSeconds)) { - return message.channel.send("Please specify a time, and a message to send after the timer has finished") + return "Please specify a time, and a message to send after the timer has finished" } let customMessage = args.slice(1).join(" ") let reminderTime = currentUnixTime + timeInSeconds From ec5993e585364cd42d64c9579a6260ce3b2da1a7 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Thu, 15 May 2025 04:39:27 +0200 Subject: [PATCH 2/4] Use UTC for consistent behaviour --- server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server.js b/server.js index b38abe4..c82911c 100644 --- a/server.js +++ b/server.js @@ -48,6 +48,7 @@ client.whitelist = { guild: new Collection(), user: new Collection() } +process.env.TZ = "UTC"; createAndLoadWhitelistTable(client.whitelist); From 22d1cbd570a0b84657fededbfe32c0713ba6a1bf Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 16 May 2025 18:53:41 +0200 Subject: [PATCH 3/4] Supply current unix timestamp with parseTime --- util/timer/createTimer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/timer/createTimer.js b/util/timer/createTimer.js index 77e3ebe..dbe8e47 100644 --- a/util/timer/createTimer.js +++ b/util/timer/createTimer.js @@ -8,7 +8,7 @@ module.exports = async function (message, args) { let currentUnixTime = Math.floor(new Date() / 1000); let timeInSeconds; - if(!isNaN(Date.parse(args[0])) && isNaN(parseTime(args[0]))){ + if(!isNaN(Date.parse(args[0])) && isNaN(parseTime(args[0], currentUnixTime))){ timeInSeconds = timeUntil(args[0]).totalInSeconds; if(timeInSeconds < 0){ return "The date must not be in the past." From 425e1c32939320b217bbf05cb0ee89d2f4605b9a Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 16 May 2025 18:54:16 +0200 Subject: [PATCH 4/4] Update check if no subcommand is supplied --- commands/misc/timer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/misc/timer.js b/commands/misc/timer.js index 4cc6282..ddbe9eb 100644 --- a/commands/misc/timer.js +++ b/commands/misc/timer.js @@ -38,7 +38,7 @@ module.exports = { sendText = "Please specify a time, and a message to send after the timer has finished"; break; } - if(!isNaN(parseTime(args[0], Math.floor(new Date() / 1000)))) + if(!isNaN(parseTime(args[0], Math.floor(new Date() / 1000)) || !isNaN(args[0]))) sendText = await createTimer(message, args); break; }