25.12.0-alpha.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 25.12.0-alpha.0
|
||||
- New: リリースノートを記録する方針を取り始めました
|
||||
- Change: tsc-aliasによるエイリアスインポートを導入しました
|
||||
- New: resolveFullPathsが有効です
|
||||
- Del: それに伴いインポートから末尾の.jsを削除しました
|
||||
- New: エイリアスに`@/`(`./src`)が追加されました
|
||||
- Change: config.d.tsの名称をconfigTypeからConfigへ変更しました
|
||||
- Change: config.d.tsの余分なinterface定義を1つのConfigとして再定義しました
|
||||
- Change: moduleResolutionをnodeからbundlerへ変更しました
|
||||
- Change: typeRootのsrc/typesを./src/typesへ変更しました
|
||||
- Change: 同一ファイルでの使用数が1つのみのインポートを静的インポートから動的インポートへ変更しました
|
||||
- Change: ディレクトリ構造を大幅に変更しました
|
||||
- Migrate: /src/wiatherId.tsを/src/constantsへ移動しました
|
||||
- Migrate: /scriptを/srcへ移動しました
|
||||
- Migrate: /typesを/src/typesへ移動しました
|
||||
- Migrate: /src/mailer.tsを/src/libへ移動しました
|
||||
- Migrate: /checksを/src/scriptsへ移動しました
|
||||
- Change: eventdayData.tsを単一のexport文のみに短縮しました
|
||||
- Delete: asciiart.txtの末尾に含まれている改行を削除しました
|
||||
- Delete: それに伴いasciiart.tsの改行を削除する正規表現を削除しました
|
||||
- Delete: package.jsonのscriptsからmainを削除しました
|
||||
- Delete: successExit.tsに含まれていたデバッグ用の関数を即時実行するコードを削除しました
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import type { configTypes } from "types/config";
|
||||
import type Config from "src/types/config";
|
||||
|
||||
// READMEの設定項目を参照
|
||||
const config: configTypes = {
|
||||
const config: Config = {
|
||||
// 時報設定
|
||||
time: {
|
||||
// 時報休止期間
|
||||
|
||||
@@ -1,63 +1,48 @@
|
||||
// 起動チェック
|
||||
import Check from "./checks/main.js";
|
||||
(async () => {
|
||||
await Check();
|
||||
})();
|
||||
(await import("@/scripts/checks/main")).default();
|
||||
(await import("@/scripts/successExit")).default();
|
||||
|
||||
// 定期実行読み込み
|
||||
import * as cron from "node-cron";
|
||||
|
||||
// 機能読み込み
|
||||
import timeNotice from "./scripts/timeNotice.js";
|
||||
import { weatherNotice } from "./scripts/weatherNotice.js";
|
||||
import earthquakeNotice from "./scripts/earthquakeNotice.js";
|
||||
import EventDays from "./scripts/eventday.js";
|
||||
import Commands from "./scripts/commands/main.js";
|
||||
|
||||
// その他機能
|
||||
import asciiArt from "./scripts/asciiart.js";
|
||||
asciiArt();
|
||||
import successExit from "./scripts/successExit.js";
|
||||
successExit();
|
||||
// アスキーアート
|
||||
(await import("@/scripts/asciiart")).default();
|
||||
|
||||
// 地震情報観測開始
|
||||
earthquakeNotice();
|
||||
(await import("@/scripts/earthquakeNotice")).default();
|
||||
|
||||
// 時報(1時間/1回)
|
||||
cron.schedule("0 * * * *", () => {
|
||||
timeNotice();
|
||||
// 定期実行
|
||||
import * as cron from "node-cron";
|
||||
|
||||
/// 時報(1時間毎)
|
||||
cron.schedule("0 * * * *", async () => {
|
||||
(await import("@/scripts/timeNotice")).default();
|
||||
});
|
||||
|
||||
// コマンド(10分/1回)
|
||||
cron.schedule("*/10 * * * *", () => {
|
||||
Commands();
|
||||
// コマンド(10分毎)
|
||||
cron.schedule("*/10 * * * *", async () => {
|
||||
(await import("@/scripts/commands/main")).default();
|
||||
});
|
||||
|
||||
// 祝日などお知らせ(毎日0:00)
|
||||
cron.schedule("0 0 * * *", () => {
|
||||
EventDays();
|
||||
// 祝日など(毎日0:00)
|
||||
cron.schedule("0 0 * * *", async () => {
|
||||
(await import("@/scripts/eventday")).default();
|
||||
});
|
||||
|
||||
// 天気お知らせ(毎日7:00)
|
||||
import { setTimeout } from "timers";
|
||||
cron.schedule("0 7 * * *", () => {
|
||||
setTimeout(() => {
|
||||
weatherNotice();
|
||||
}, 100);
|
||||
cron.schedule("0 7 * * *", async () => {
|
||||
(await import("@/scripts/weatherNotice")).weatherNotice();
|
||||
});
|
||||
|
||||
// 管理パネル
|
||||
import AdminPanel from "./panel/main.js";
|
||||
(async () => {
|
||||
await AdminPanel();
|
||||
})();
|
||||
await (await import("./panel/main")).default()
|
||||
|
||||
// 起動表示
|
||||
console.log("BOTサーバーが起動しました");
|
||||
|
||||
import config from "./config.js";
|
||||
import { styleText } from "util";
|
||||
if (config.debug !== undefined) {
|
||||
if ((await import("./config")).default.debug) {
|
||||
// TLSを任意に設定
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
console.log(styleText(["bgRed", "cyan", "bold"], "デバッグモードで起動中"));
|
||||
|
||||
console.log((await import("node:util")).styleText(
|
||||
["bgRed", "cyan", "bold"],
|
||||
"デバッグモードで起動中"
|
||||
));
|
||||
}
|
||||
|
||||
+3
-4
@@ -6,10 +6,9 @@
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"start": "node .",
|
||||
"build": "tsc",
|
||||
"main": "tsc && node .",
|
||||
"build": "tsc && tsc-alias",
|
||||
"dev": "tsx main.ts",
|
||||
"clean": "tsc && node dist/scripts/clean/main.js"
|
||||
"clean": "npm run build && node dist/scripts/clean/main.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -52,7 +51,7 @@
|
||||
"node-cron": "^4.1.1",
|
||||
"nodemailer": "^7.0.4",
|
||||
"sharp": "^0.34.3",
|
||||
"timers": "^0.1.1",
|
||||
"tsc-alias": "^1.8.16",
|
||||
"typescript": "^5.9.2",
|
||||
"ws": "^8.18.3"
|
||||
},
|
||||
|
||||
+8
-16
@@ -1,15 +1,7 @@
|
||||
import express from "express";
|
||||
import * as os from "os";
|
||||
import config from "../config.js";
|
||||
import { NetworkInterfaceDetails } from "types/types";
|
||||
|
||||
// バックエンドルーティング
|
||||
import CommandExecute from "./route/command.js";
|
||||
import ueusePost from "./route/ueuse.js";
|
||||
import WeatherUeuse from "./route/weather.js";
|
||||
import API from "./route/api.js";
|
||||
import Token from "./route/token.js";
|
||||
import Debug from "./route/debug.js";
|
||||
import config from "../config";
|
||||
import { NetworkInterfaceDetails } from "@/types/types";
|
||||
|
||||
export default async function AdminPanel() {
|
||||
// 無効
|
||||
@@ -22,12 +14,12 @@ export default async function AdminPanel() {
|
||||
const port = config.admin.panel.port;
|
||||
|
||||
// ルーティング
|
||||
app.use(ueusePost);
|
||||
app.use(CommandExecute);
|
||||
app.use(WeatherUeuse);
|
||||
app.use(API);
|
||||
app.use(Token);
|
||||
app.use(Debug);
|
||||
app.use((await import("./route/ueuse")).default);
|
||||
app.use((await import("./route/command")).default);
|
||||
app.use((await import("./route/weather")).default);
|
||||
app.use((await import("./route/api")).default);
|
||||
app.use((await import("./route/token")).default);
|
||||
app.use((await import("./route/debug")).default);
|
||||
app.use(express.static("panel/public"));
|
||||
|
||||
app.listen(port, () => {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const API = express.Router();
|
||||
|
||||
import config from "../../config.js";
|
||||
import config from "../../config";
|
||||
|
||||
API.use(express.json());
|
||||
API.use(express.urlencoded({ extended: true }));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const CommandExecute = express.Router();
|
||||
|
||||
import Commands from "../../scripts/commands/main.js";
|
||||
import Commands from "@/scripts/commands/main";
|
||||
|
||||
CommandExecute.post("/actions/command-execute", (req, res) => {
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const Debug = express.Router();
|
||||
|
||||
import config from "../../config.js";
|
||||
import config from "../../config";
|
||||
|
||||
Debug.post("/actions/debug", (req, res, next) => {
|
||||
res.status(501)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const EventdayUeuse = express.Router();
|
||||
|
||||
import EventDays from "../../scripts/eventday.js";
|
||||
import EventDays from "@/scripts/eventday";
|
||||
|
||||
EventdayUeuse.post("/actions/eventday", (req, res) => {
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const Token = express.Router();
|
||||
|
||||
import config from "../../config.js";
|
||||
import config from "../../config";
|
||||
|
||||
Token.post("/actions/token", (req, res, next) => {
|
||||
res.status(501)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const ueusePost = express.Router();
|
||||
|
||||
import config from "../../config.js";
|
||||
import config from "../../config";
|
||||
|
||||
ueusePost.use(express.json());
|
||||
ueusePost.use(express.urlencoded({ extended: true }));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import express from "express";
|
||||
const WeatherUeuse = express.Router();
|
||||
|
||||
import { weatherNotice } from "../../scripts/weatherNotice.js";
|
||||
import { weatherNotice } from "@/scripts/weatherNotice";
|
||||
|
||||
WeatherUeuse.post("/actions/weather", (req, res) => {
|
||||
try {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
interface eventdaysValue {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
const eventdays = {
|
||||
export default {
|
||||
"01/01": {
|
||||
name: "元日",
|
||||
message: "はい年越した瞬間地球にいなかった~",
|
||||
@@ -65,6 +60,7 @@ const eventdays = {
|
||||
name: "大晦日",
|
||||
message: "大掃除!!大掃除!!",
|
||||
},
|
||||
} as { [key: string]: eventdaysValue };
|
||||
|
||||
export default eventdays;
|
||||
} as { [key: string]: {
|
||||
name: string;
|
||||
message: string;
|
||||
} };
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import config from "../../config.js";
|
||||
import config from "../../config";
|
||||
import * as nodemailer from "nodemailer";
|
||||
|
||||
import type SMTPTransport from "nodemailer/lib/smtp-transport";
|
||||
|
||||
@@ -3,6 +3,6 @@ import * as fs from "fs";
|
||||
const version = JSON.parse(fs.readFileSync("package.json", "utf-8")).version;
|
||||
|
||||
export default function asciiArt() {
|
||||
console.log(fs.readFileSync("asciiart.txt", "utf-8").replace(/(\r?\n)$/, ''));
|
||||
console.log(fs.readFileSync("asciiart.txt", "utf-8"));
|
||||
console.log(`${version}\n`);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import logsDelete from "./logsDel.js";
|
||||
import packageLockJsonDelete from "./packageLockDel.js";
|
||||
import npmInstall from "./npmInstall.js";
|
||||
(await import("@/scripts/clean/logsDel")).default();
|
||||
(await import("@/scripts/clean/packageLockDel")).default();
|
||||
(await import("@/scripts/clean/npmInstall")).default();
|
||||
|
||||
logsDelete();
|
||||
packageLockJsonDelete();
|
||||
npmInstall();
|
||||
export {};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { meApi, ueuse } from "../../src/types/types";
|
||||
import config from "../../config.js";
|
||||
import { Reply } from "./main.js";
|
||||
import { meApi, ueuse } from "@/types/types";
|
||||
import config from "../../../config";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
|
||||
export default async function Delete(data: ueuse) {
|
||||
const meReq = await fetch(`${config.uwuzu.host}/api/me/`, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import config from "../../config.js";
|
||||
import { Reply } from "./main.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
import config from "../../../config";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
|
||||
export default async function Follow(data: ueuse) {
|
||||
const followReq = await fetch(`${config.uwuzu.host}/api/users/follow`, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
import { readFileSync } from "fs";
|
||||
import { Reply } from "./main.js";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
|
||||
const helpsMin = {
|
||||
"info": "このBOTについての概要を返信するコマンドです。",
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { readFileSync } from "fs";
|
||||
import { Reply } from "./main.js";
|
||||
import config from "../../config.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
import config from "../../../config";
|
||||
|
||||
export default async function Info(data: ueuse) {
|
||||
const packageJson = JSON.parse(readFileSync("package.json", "utf-8"));
|
||||
const packageJson = JSON.parse((await import("fs")).readFileSync("package.json", "utf-8"));
|
||||
const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`;
|
||||
|
||||
let editor = "";
|
||||
@@ -29,7 +27,7 @@ export default async function Info(data: ueuse) {
|
||||
isReport = "無効";
|
||||
}
|
||||
|
||||
const ueuse = await Reply(`
|
||||
const ueuse = await (await import("@/scripts/commands/main")).Reply(`
|
||||
【BOTについて】
|
||||
このBOTはオープンソースソフトウェアであるnoticeUwuzuを利用して運営されています。
|
||||
noticeUwuzuはApache License 2.0によって保護されています。
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { Reply } from "../main.js";
|
||||
import config from "../../../config.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
|
||||
export default function PrivacyPolicy(data: ueuse) {
|
||||
Reply(config.legal.privacy, data.uniqid);
|
||||
export default async function PrivacyPolicy(data: ueuse) {
|
||||
(await import("@/scripts/commands/main")).Reply(
|
||||
(await import("../../../../config")).default.legal.privacy,
|
||||
data.uniqid
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { Reply } from "../main.js";
|
||||
import config from "../../../config.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
|
||||
export default function Terms(data: ueuse) {
|
||||
Reply(config.legal.terms, data.uniqid);
|
||||
export default async function Terms(data: ueuse) {
|
||||
(await import("@/scripts/commands/main")).Reply(
|
||||
(await import("../../../../config")).default.legal.terms,
|
||||
data.uniqid
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,12 @@
|
||||
import * as fs from "fs";
|
||||
import config from "../../config.js";
|
||||
import type { ueuse } from "src/types/types.js";
|
||||
|
||||
const initialFile: Array<string> = [];
|
||||
|
||||
// コマンド読み込み
|
||||
import Info from "./info.js";
|
||||
import Help from "./help.js";
|
||||
import Follow from "./follow.js";
|
||||
import UnFollow from "./unfollow.js";
|
||||
import Weather from "./weather.js";
|
||||
import Report from "./report.js";
|
||||
import Terms from "./legal/terms.js"
|
||||
import PrivacyPolicy from "./legal/privacy.js";
|
||||
import Delete from "./delete.js";
|
||||
import MakeItAQuote from "./miq/main.js";
|
||||
import MiQPermission from "./miq/permission.js";
|
||||
import MiQAllow from "./miq/allow.js";
|
||||
import config from "../../../config";
|
||||
import type { ueuse } from "@/types/types";
|
||||
|
||||
// 初期化
|
||||
if (!fs.existsSync("data/alreadyCommands.json")) {
|
||||
fs.writeFileSync(
|
||||
"data/alreadyCommands.json",
|
||||
JSON.stringify(initialFile),
|
||||
JSON.stringify([]),
|
||||
"utf-8",
|
||||
);
|
||||
}
|
||||
@@ -162,40 +146,40 @@ export default async function Commands() {
|
||||
|
||||
switch (commandName) {
|
||||
case "info":
|
||||
Info(data);
|
||||
(await import("@/scripts/commands/info")).default(data);
|
||||
break;
|
||||
case "help":
|
||||
Help(data);
|
||||
(await import("@/scripts/commands/help")).default(data);
|
||||
break;
|
||||
case "legal terms":
|
||||
Terms(data);
|
||||
(await import("@/scripts/commands/legal/terms")).default(data);
|
||||
break;
|
||||
case "legal privacy":
|
||||
PrivacyPolicy(data);
|
||||
(await import("@/scripts/commands/legal/privacy")).default(data);
|
||||
break;
|
||||
case "report":
|
||||
Report(data);
|
||||
(await import("@/scripts/commands/report")).default(data);
|
||||
break;
|
||||
case "follow":
|
||||
Follow(data);
|
||||
(await import("@/scripts/commands/follow")).default(data);
|
||||
break;
|
||||
case "unfollow":
|
||||
UnFollow(data);
|
||||
(await import("@/scripts/commands/unfollow")).default(data);
|
||||
break;
|
||||
case "weather":
|
||||
Weather(data);
|
||||
(await import("@/scripts/commands/weather")).default(data);
|
||||
break;
|
||||
case "miq":
|
||||
MakeItAQuote(data);
|
||||
(await import("@/scripts/commands/miq/main")).default(data);
|
||||
break;
|
||||
case "miq permission":
|
||||
MiQPermission(data);
|
||||
(await import("@/scripts/commands/miq/permission")).default(data);
|
||||
break;
|
||||
case "miq allow":
|
||||
MiQAllow(data);
|
||||
(await import("@/scripts/commands/miq/allow")).default(data);
|
||||
break;
|
||||
case "delete":
|
||||
Delete(data);
|
||||
(await import("@/scripts/commands/delete")).default(data);
|
||||
break;
|
||||
default:
|
||||
const reply = await Reply(`
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { meApi, ueuse } from "../../../src/types/types";
|
||||
import { readFileSync } from "fs";
|
||||
import config from "../../../config.js";
|
||||
import { Reply } from "../main.js";
|
||||
import { Permission } from "./permission";
|
||||
import MiQ from "../../../miq/main.js";
|
||||
import { meApi, ueuse } from "@/types/types";
|
||||
import config from "../../../../config";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
import { Permission } from "@/scripts/commands/miq/permission";
|
||||
import MiQ from "../../../../miq/main";
|
||||
|
||||
export default async function MiQAllow(data: ueuse) {
|
||||
if (!config.miq) {
|
||||
@@ -22,7 +21,7 @@ export default async function MiQAllow(data: ueuse) {
|
||||
|
||||
// 権限一覧取得
|
||||
const permissions: { [user: string]: Permission } =
|
||||
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
|
||||
if (permissions[data.account.userid] !== "consent") {
|
||||
console.log("MiQ許可制(許可制以外):", await Reply(`
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { ueuse } from "../../../src/types/types";
|
||||
import MiQ from "../../../miq/main.js";
|
||||
import config from "../../../config.js";
|
||||
import { Reply } from "../main.js";
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { Permission } from "./permission";
|
||||
import { ueuse } from "@/types/types";
|
||||
import config from "../../../../config";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
import type { Permission } from "@/scripts/commands/miq/permission";
|
||||
|
||||
export default async function MakeItAQuote(data: ueuse) {
|
||||
if (!config.miq) {
|
||||
@@ -47,12 +45,12 @@ export default async function MakeItAQuote(data: ueuse) {
|
||||
|
||||
// 権限一覧取得
|
||||
const permissions: { [user: string]: Permission } =
|
||||
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
|
||||
// 初期化
|
||||
if (permissions[ueuseData.account.userid] === undefined) {
|
||||
permissions[ueuseData.account.userid] = "consent";
|
||||
writeFileSync(
|
||||
(await import("fs")).writeFileSync(
|
||||
"data/miqPermissions.json",
|
||||
JSON.stringify(permissions),
|
||||
"utf-8"
|
||||
@@ -82,7 +80,7 @@ export default async function MakeItAQuote(data: ueuse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const img = await MiQ({
|
||||
const img = await (await import("../../../../miq/main")).default({
|
||||
type: "Base64Data",
|
||||
color: color,
|
||||
text: ueuseData.text,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { ueuse } from "../../../src/types/types";
|
||||
import { Reply } from "../main.js";
|
||||
import config from "../../../config.js";
|
||||
import { readFileSync, writeFileSync, existsSync } from "fs";
|
||||
import { ueuse } from "@/types/types";
|
||||
import { Reply } from "@/scripts/commands/main";
|
||||
import { writeFileSync } from "fs";
|
||||
|
||||
// 初期化
|
||||
const initialFile = {};
|
||||
if (!existsSync("data/miqPermissions.json")) {
|
||||
if (!(await import("fs")).existsSync("data/miqPermissions.json")) {
|
||||
writeFileSync(
|
||||
"data/miqPermissions.json",
|
||||
JSON.stringify(initialFile),
|
||||
@@ -25,7 +24,7 @@ const PermissionsNames: { [name: string]: string } = {
|
||||
}
|
||||
|
||||
export default async function MiQPermission(data: ueuse) {
|
||||
if (!config.miq) {
|
||||
if (!(await import("../../../../config")).default.miq) {
|
||||
await Reply(`
|
||||
BOT管理者によってMake it a quoteが無効化されています。
|
||||
そのため\`/miq\`はご利用いただけません。
|
||||
@@ -34,7 +33,7 @@ export default async function MiQPermission(data: ueuse) {
|
||||
}
|
||||
|
||||
const permissions: { [user: string]: string } =
|
||||
JSON.parse(readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
JSON.parse((await import("fs")).readFileSync("data/miqPermissions.json", "utf-8"));
|
||||
|
||||
// 初期化
|
||||
if (permissions[data.account.userid] === undefined) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { Reply } from "./main.js";
|
||||
import config from "../../config.js";
|
||||
import sendMail from "../../src/lib/mailer.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
import { Reply } from "./main";
|
||||
import config from "../../../config";
|
||||
|
||||
export default async function Report(data: ueuse) {
|
||||
if (
|
||||
@@ -40,7 +39,7 @@ export default async function Report(data: ueuse) {
|
||||
}
|
||||
|
||||
try {
|
||||
sendMail({
|
||||
(await import("@/lib/mailer")).default({
|
||||
to: config.emergency.mail.to,
|
||||
subject: "【報告】BOT利用者からの報告",
|
||||
text: `
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import config from "../../config.js";
|
||||
import { Reply } from "./main.js";
|
||||
import { ueuse } from "@/types/types";
|
||||
import config from "../../../config";
|
||||
import { Reply } from "./main";
|
||||
|
||||
export default async function UnFollow(data: ueuse) {
|
||||
const unfollowReq = await fetch(`${config.uwuzu.host}/api/users/unfollow`, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { weatherReply } from "../weatherNotice.js";
|
||||
import { ueuse } from "src/types/types.js";
|
||||
import { weatherReply } from "@/scripts/weatherNotice";
|
||||
import { ueuse } from "@/types/types.js";
|
||||
|
||||
export default function Weather(data: ueuse) {
|
||||
weatherReply(data.uniqid);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import WebSocket from "ws";
|
||||
import sendMail from "../src/lib/mailer.js";
|
||||
|
||||
import config from "../config.js";
|
||||
import sendMail from "@/lib/mailer";
|
||||
import config from "../../config.js";
|
||||
|
||||
class P2PEarthquakeClient {
|
||||
private ws: WebSocket | null = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { format } from "date-fns";
|
||||
import eventdays from "./eventdayData.js";
|
||||
import config from "../config.js";
|
||||
import eventdays from "@/constants/eventday";
|
||||
import config from "../../config";
|
||||
|
||||
export default async function EventDays() {
|
||||
const now = format(new Date(), "MM/dd");
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as fs from "fs";
|
||||
import { isAfter } from "date-fns";
|
||||
|
||||
import config from "../config.js";
|
||||
import sendMail from "../src/lib/mailer.js";
|
||||
import config from "../../config";
|
||||
import sendMail from "@/lib/mailer";
|
||||
|
||||
export default function successExit() {
|
||||
// 初期化
|
||||
@@ -56,5 +55,3 @@ export default function successExit() {
|
||||
fs.writeFileSync("logs/boot.json", JSON.stringify(iolog), "utf-8");
|
||||
});
|
||||
}
|
||||
|
||||
successExit();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { format } from "date-fns";
|
||||
|
||||
import type * as types from "src/types/types.js";
|
||||
import config from "../config.js";
|
||||
import type * as types from "@/types/types";
|
||||
import config from "../../config";
|
||||
|
||||
export default async function timeNotice() {
|
||||
// 停止時間
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { cityList } from "../src/constants/weatherId.js";
|
||||
|
||||
import type * as types from "src/types/types.js";
|
||||
|
||||
import config from "../config.js";
|
||||
import { cityList } from "@/constants/weather";
|
||||
import type * as types from "@/types/types";
|
||||
import config from "../../config";
|
||||
|
||||
export async function weatherNotice() {
|
||||
console.log("----------------");
|
||||
|
||||
Vendored
+33
-61
@@ -1,24 +1,24 @@
|
||||
interface earthquakeTypes {
|
||||
export default interface Config {
|
||||
time: {
|
||||
stopTimes: {
|
||||
start: number;
|
||||
stop: number;
|
||||
};
|
||||
};
|
||||
earthquake: {
|
||||
reconnectTimes: number;
|
||||
websocketUrl: string;
|
||||
areasCsvUrl: string;
|
||||
maxScaleMin: number;
|
||||
}
|
||||
|
||||
interface weatherTypes {
|
||||
};
|
||||
weather: {
|
||||
splitCount: number;
|
||||
}
|
||||
};
|
||||
miq: boolean;
|
||||
|
||||
interface stopsTypes {
|
||||
start: number;
|
||||
stop: number;
|
||||
}
|
||||
|
||||
interface timeTypes {
|
||||
stopTimes: stopsTypes;
|
||||
}
|
||||
|
||||
interface emergencyMailFullTypes {
|
||||
emergency: {
|
||||
isEnabled: true;
|
||||
mail: {
|
||||
isEnabled: true;
|
||||
host: string;
|
||||
port: number;
|
||||
@@ -26,62 +26,34 @@ interface emergencyMailFullTypes {
|
||||
password: string;
|
||||
secure: boolean;
|
||||
to: string | string[];
|
||||
}
|
||||
|
||||
interface emergencyMailMinTypes {
|
||||
} | {
|
||||
isEnabled: false;
|
||||
mail: undefined;
|
||||
}
|
||||
|
||||
interface emergencyFullTypes {
|
||||
isEnabled: true;
|
||||
mail: emergencyMailFullTypes | emergemcyMailMinTypes;
|
||||
}
|
||||
|
||||
interface emergencyMinTypes {
|
||||
};
|
||||
} | {
|
||||
isEnabled: false;
|
||||
}
|
||||
|
||||
interface reportTypes {
|
||||
};
|
||||
report: {
|
||||
isEnabled: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface legalTypes {
|
||||
};
|
||||
legal: {
|
||||
terms: string;
|
||||
privacy: string;
|
||||
}
|
||||
|
||||
interface PanelFullTypes {
|
||||
isEnabled: true;
|
||||
port: number;
|
||||
}
|
||||
|
||||
interface PanelMinTypes {
|
||||
isEnabled: false;
|
||||
}
|
||||
|
||||
interface adminTypes {
|
||||
};
|
||||
admin: {
|
||||
name: string;
|
||||
showMail: string | false;
|
||||
panel: PanelFullTypes | PanelMinTypes;
|
||||
}
|
||||
|
||||
interface uwuzuTypes {
|
||||
panel: {
|
||||
isEnabled: true;
|
||||
port: number;
|
||||
} | {
|
||||
isEnabled: false;
|
||||
};
|
||||
};
|
||||
uwuzu: {
|
||||
apiToken: string;
|
||||
host: string;
|
||||
}
|
||||
|
||||
export interface configTypes {
|
||||
time: timeTypes,
|
||||
earthquake: earthquakeTypes;
|
||||
weather: weatherTypes;
|
||||
miq: boolean;
|
||||
|
||||
emergency: emergencyFullTypes | emergencyMinTypes;
|
||||
report: reportTypes;
|
||||
legal: legalTypes;
|
||||
admin: adminTypes;
|
||||
uwuzu: uwuzuTypes;
|
||||
};
|
||||
debug?: true;
|
||||
}
|
||||
|
||||
+6
-2
@@ -2,7 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"target": "ES2024",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "bundler",
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
@@ -12,12 +12,16 @@
|
||||
"baseUrl": "./",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./types"
|
||||
"./src/types"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"ws": ["./node_modules/ws/index.js"],
|
||||
"@types/ws": ["./node_modules/@types/ws/index.d.ts"]
|
||||
},
|
||||
"removeComments": true,
|
||||
},
|
||||
"tsc-alias": {
|
||||
"resolveFullPaths": true,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user