From 2efe702309ab1abf7a38fc1a6cd84f4ee3756c79 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Fri, 18 Oct 2024 22:39:04 +0900 Subject: [PATCH] fix: Now automatically update last updated date --- package.json | 2 +- src/client.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 90a0e5f..cf66f8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "4.0.0-pudding.p241017a", + "version": "4.0.0-pudding.p241018a", "main": "dist/src/index.js", "private": true, "dependencies": { diff --git a/src/client.ts b/src/client.ts index 33b2429..c5a6c82 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,13 +11,21 @@ const release = version .slice((semver.coerce(version)?.toString() + '-').length) .split('.')[1] +function getLastUpdated() { + const updated = release.match(/[0-9]/g)!.join('') + const year = updated.slice(0, 2) + const month = updated.slice(2, 4) + const day = updated.slice(4, 6) + return `20${year}-${month}-${day}` +} + container.config = config container.prefix = config.bot.prefix container.version = version container.database = new PrismaClient() container.dokdoAliases = ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트'] container.chatBot = new ChatBot(container.database) -container.lastUpdated = new Date('2024-10-09') +container.lastUpdated = new Date(getLastUpdated()) container.embedColors = { default: 0xaddb87, fail: 0xff0000,