feat: Integrate VTS functionality and improve emoji response system

- Added VTSList function to read and process Excel file for V.T.S. entries.
- Implemented isVTS function to check if a given date is in the VTS list.
- Updated CreateImage class to conditionally display "with V.T.S." based on VTS status.
- Enhanced NameToEmoji function's prompt for clarity and formatting.
- Added exceljs dependency for Excel file handling.
- Modified playground.ts for testing VTS functionality.
This commit is contained in:
imnyang 2025-05-10 21:09:55 +09:00
commit 42be227916
6 changed files with 317 additions and 11 deletions

View file

@ -3,6 +3,7 @@ import { join } from "path";
import { createCanvas, loadImage, GlobalFonts } from "@napi-rs/canvas";
import { getMealInfo, NameToEmoji } from "./meal"; // 이 함수의 내용은 제공되지 않았으므로 그대로 둡니다.
import { getAllSchedules } from "./schedule";
import { isVTS } from "./vts";
GlobalFonts.registerFromPath('./template/Pretendard-Bold.ttf', 'Pretendard Bold')
GlobalFonts.registerFromPath('./template/NotoColorEmoji-Regular.ttf', 'NotoColorEmoji Regular')
@ -51,10 +52,10 @@ export class CreateImage {
ctx.fillStyle = "#89CAFF";
ctx.fillText(mealInfo.kcal, 945, 220);
/*if (vts.VTS(MLSV_YMD)) {
if (await isVTS(MLSV_YMD)) {
ctx.fillStyle = "#CDAD94";
ctx.fillText("with V.T.S.", 830, 225);
}*/ // VTS
ctx.fillText("with V.T.S.", 952.5, 245);
} // VTS 관련 코드 주석 처리
const outPath = path.join("./temp", `${MLSV_YMD}.png`); // 경로 수정: "./temp/" -> "./temp"
const buffer = canvas.toBuffer("image/png");