Add initial project setup with Docker, GitHub Actions, and meal timetable functionality
- Create Dockerfile for multi-stage build - Set up GitHub Actions workflow for CI/CD - Implement meal and timetable fetching logic - Add README and configuration files - Include cron job for scheduled execution - Establish .gitignore for build artifacts and environment files
This commit is contained in:
commit
40116ec84c
14 changed files with 519 additions and 0 deletions
48
app/index.ts
Normal file
48
app/index.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { Weekday } from "@imnyang/comcigan.ts";
|
||||
import { Meal, Timetable } from "./lib/discord";
|
||||
|
||||
async function main() {
|
||||
// Tomorrow is 1st of the month
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
const YYMMDD = tomorrow.toISOString().slice(0, 10).replace(/-/g, "").toString();
|
||||
// const YYMMDD = "20250306";
|
||||
const weekday = tomorrow.getDay() === 0 ? 6 : tomorrow.getDay() - 1;
|
||||
// const weekday = 4;
|
||||
|
||||
console.log("📅 | date:", YYMMDD);
|
||||
console.log("📅 | weekday:", weekday);
|
||||
console.timeLog("⏱️ | sunrint");
|
||||
await Timetable({
|
||||
schoolId: 41896,
|
||||
grade: 1,
|
||||
classNum: 1,
|
||||
weekday: Weekday.Friday,
|
||||
WEBHOOK_URL: process.env.DISCORD_WEBHOOK_SUNRIN_URL as string
|
||||
})
|
||||
await Meal({
|
||||
MLSV_YMD: YYMMDD,
|
||||
ATPT_OFCDC_SC_CODE: "B10",
|
||||
SD_SCHUL_CODE: "7010536",
|
||||
username: "@today.sunrin",
|
||||
schoolName: "선린인터넷고등학교",
|
||||
WEBHOOK_URL: process.env.DISCORD_WEBHOOK_SUNRIN_URL as string
|
||||
}); // 선린인고
|
||||
console.timeEnd("⏱️ | sunrint");
|
||||
|
||||
console.timeLog("⏱️ | sangjeong");
|
||||
await Meal({
|
||||
MLSV_YMD: YYMMDD,
|
||||
ATPT_OFCDC_SC_CODE: "B10",
|
||||
SD_SCHUL_CODE: "7010536",
|
||||
username: "@today.isangjeong",
|
||||
schoolName: "상정고등학교",
|
||||
WEBHOOK_URL: process.env.DISCORD_WEBHOOK_SANGJEONG_URL as string
|
||||
}); // 상정고
|
||||
console.timeEnd("⏱️ | sangjeong");
|
||||
};
|
||||
|
||||
main().catch((error) => {
|
||||
console.error("Error in main function:", error);
|
||||
process.exit(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue