diff --git a/discord/bot.ts b/discord/bot.ts index 983f4d4..e7a199f 100644 --- a/discord/bot.ts +++ b/discord/bot.ts @@ -86,7 +86,7 @@ async function scheduleRandomMessage(firstTime = false) const timeoutMins = Math.random() * 360 + 120; const scheduledTime = new Date(); scheduledTime.setMinutes(scheduledTime.getMinutes() + timeoutMins); - logInfo(`[bot] Next MOTD: ${scheduledTime}`); + logInfo(`[bot] Next MOTD: ${scheduledTime.toLocaleTimeString()}`); setTimeout(scheduleRandomMessage, timeoutMins * 60 * 1000); } diff --git a/discord/util.ts b/discord/util.ts index 16d1388..f791d17 100644 --- a/discord/util.ts +++ b/discord/util.ts @@ -16,16 +16,20 @@ const reactionEmojis: string[] = process.env.REACTIONS.split(','); let db: Database = null; +function curDateStr() { + return new Date().toJSON().replace('T', ' ').replace('Z', ''); +} + function logInfo(...data) { - console.log(`[${new Date()}] ${data.join(' ')}`); + console.log(`[${curDateStr()}] ${data.join(' ')}`); } function logWarn(...data) { - console.warn(`[${new Date()}] ${data.join(' ')}`); + console.warn(`[${curDateStr()}] ${data.join(' ')}`); } function logError(...data) { - console.error(`[${new Date()}] ${data.join(' ')}`); + console.error(`[${curDateStr()}] ${data.join(' ')}`); } async function openDb() {