이건 Python이 잘못했다다

This commit is contained in:
imnyang 2025-05-09 20:11:41 +09:00
commit ca946990e1
41 changed files with 3081 additions and 964 deletions

39
app/lib/discord.ts Normal file
View file

@ -0,0 +1,39 @@
import { getMealInfo } from "./meal";
const WEBHOOK_URL = process.env.DISCORD_WEBHOOK_URL as string;
export async function Discord(MLSV_YMD: string) {
const mealInfo = await getMealInfo(MLSV_YMD);
//const isVTS = vts.VTS임(MLSV_YMD);
const data = {
// To include VTS info, uncomment and define isVTS:
// content: `${MLSV_YMD.slice(0, 4)}년 ${MLSV_YMD.slice(4, 6)}월 ${MLSV_YMD.slice(6, 8)}일 급식 정보${isVTS ? " | with V.T.S." : ""}`,
content: `${MLSV_YMD.slice(0, 4)}${MLSV_YMD.slice(
4,
6
)} ${MLSV_YMD.slice(6, 8)} `,
username: "@today.isangjeong",
embeds: [
{
title: "🏫 | 인천상정중학교",
description: `🔥 ${mealInfo.kcal}\n\n${mealInfo.meal}`,
},
],
};
console.log("🏓 | Sending Payload");
const response = await fetch(WEBHOOK_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
if (!response.ok) {
console.error("Error sending Discord webhook:", response.statusText);
} else {
console.log(`✨ | Payload successfully, code ${response.status}`);
}
}