Feat: 新年迎春
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import client from "@/lib/client";
|
||||
import initI18n from "@/lib/i18n";
|
||||
import i18next from "i18next";
|
||||
import { parentPort } from "node:worker_threads";
|
||||
|
||||
await initI18n();
|
||||
|
||||
parentPort?.on("message", async () => {
|
||||
console.log("新年迎春の投稿を行います");
|
||||
|
||||
try {
|
||||
const response = await client.request("ueuse/create", {
|
||||
text: i18next.t("hnyNotice", { year: String(new Date().getFullYear()) }),
|
||||
});
|
||||
|
||||
if (!response.success) {
|
||||
console.warn("新年迎春投稿に失敗しました:", response.error_code);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("新年迎春投稿:", response.uniqid);
|
||||
} catch (err: any) {
|
||||
console.error("message" in err
|
||||
? err.message
|
||||
: err);
|
||||
} finally {
|
||||
parentPort?.postMessage("");
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user