2026.4.0-alpha.0

This commit is contained in:
2026-04-27 19:55:50 +09:00
commit ecbfc828d6
24 changed files with 3131 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
import { schedule } from "node-cron";
import { readFileSync } from "node:fs";
import config from "@/lib/config";
import initI18n from "@/lib/i18n";
import { initUserID } from "@/lib/memory";
import { styleText } from "node:util";
import timeNotice from "@/feature/timeNotice";
import { weatherNotice } from "@/feature/weatherNotice";
import commandExecute from "@/feature/command";
import P2PEarthquakeClient from "@/feature/earthquakeNotice";
try {
console.log(readFileSync(`${import.meta.dirname}/../asciiart.txt`, "utf-8"));
console.log(JSON.parse(readFileSync(`${import.meta.dirname}/../package.json`, "utf-8")).version);
if (config.debug) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
console.log(styleText(
["bgRed", "cyan", "bold"],
"デバッグモードが有効です",
));
}
console.log();
await initI18n();
await initUserID();
P2PEarthquakeClient();
console.log("Botが起動しました");
} catch (err: any) {
console.error("message" in err
? err.message
: err);
process.exit(1);
}
schedule("0 * * * *", async () => {
console.log("時報の投稿を行います");
try {
await timeNotice();
} catch (err: any) {
console.error("message" in err
? err.message
: err);
}
});
schedule("0 7 * * *", async () => {
console.log("天気予報の投稿を行います");
try {
await weatherNotice();
} catch (err: any) {
console.error("message" in err
? err.message
: err);
}
});
schedule(`*/${config.command.interval} * * * *`, async () => {
console.log("コマンドの処理を行います");
try {
await commandExecute();
} catch (err: any) {
console.error("message" in err
? err.message
: err);
}
});