import * as cron from "node-cron"; import * as dotenv from "dotenv"; import { format } from "date-fns"; dotenv.config(); async function ueuse() { const now = format(new Date(), "HH:mm"); console.log(now); const res = await fetch(`https://${process.env.SERVER}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: process.env.TOKEN, text: `日本時間${now}になりました`, }), }); } cron.schedule("0 * * * *", () => { ueuse(); });