25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import { createUeuse } from "@/lib/client";
|
|
import initI18n from "@/lib/i18n";
|
|
import { format } from "date-fns";
|
|
import i18next from "i18next";
|
|
import { parentPort } from "node:worker_threads";
|
|
|
|
await initI18n();
|
|
|
|
parentPort?.on("message", async () => {
|
|
console.log("新年迎春の投稿を行います");
|
|
|
|
try {
|
|
await createUeuse({
|
|
text: i18next.t("hnyNotice", { year: String(new Date().getFullYear()) }),
|
|
}, "新年迎春");
|
|
|
|
console.log("新年迎春投稿時刻:", format(new Date(), "yyyy/M/d H:mm:ss:SSS"));
|
|
process.exit(0);
|
|
} catch (err: any) {
|
|
console.error("message" in err
|
|
? err.message
|
|
: err);
|
|
process.exit(1);
|
|
}
|
|
}); |