설정 보강 및 메시지 동작 정리

RESET_TOKEN을 .env에서 읽도록 바꾸고 한국 시간 표시와 시간대별 클릭 메시지 동작을 정리합니다.
This commit is contained in:
2026-06-10 12:42:14 +09:00
parent f7ee8cb923
commit 5f9f10f305
8 changed files with 279 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ const path = require('path');
const Database = require('better-sqlite3');
const FALLBACK_EMOJIS = ['🐱', '🐰', '🐥', '🦊', '🍀', '🌸', '✨', '🎉', '💫', '🌈', '🍓', '🌙'];
const DISPLAY_TIME_ZONE = 'Asia/Seoul';
function ensureDirectory(filePath) {
const directory = path.dirname(filePath);
@@ -129,21 +130,41 @@ function buildStatus(db, config) {
}
function formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const parts = getDateTimeParts(date);
const year = parts.year;
const month = parts.month;
const day = parts.day;
const hours = parts.hour;
const minutes = parts.minute;
return `${year}-${month}-${day} ${hours}:${minutes}`;
}
function formatTime(date) {
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
const parts = getDateTimeParts(date);
const hours = parts.hour;
const minutes = parts.minute;
const seconds = parts.second;
return `${hours}:${minutes}:${seconds}`;
}
function getDateTimeParts(date) {
return Object.fromEntries(
new Intl.DateTimeFormat('ko-KR', {
timeZone: DISPLAY_TIME_ZONE,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
})
.formatToParts(date)
.filter((part) => part.type !== 'literal')
.map((part) => [part.type, part.value])
);
}
function recordCheck(db, config, requestedEmoji) {
const emoji =
typeof requestedEmoji === 'string' && requestedEmoji.trim()